MCPcopy
hub / github.com/socketio/socket.io / _fetch

Method _fetch

packages/engine.io-client/lib/transports/polling-fetch.ts:41–62  ·  view source on GitHub ↗
(data?: string)

Source from the content-addressed store, hash-verified

39 }
40
41 private _fetch(data?: string) {
42 const isPost = data !== undefined;
43 const headers = new Headers(this.opts.extraHeaders);
44
45 if (isPost) {
46 headers.set("content-type", "text/plain;charset=UTF-8");
47 }
48
49 this.socket._cookieJar?.appendCookies(headers);
50
51 return fetch(this.uri(), {
52 method: isPost ? "POST" : "GET",
53 body: isPost ? data : null,
54 headers,
55 credentials: this.opts.withCredentials ? "include" : "omit",
56 }).then((res) => {
57 // @ts-ignore getSetCookie() was added in Node.js v19.7.0
58 this.socket._cookieJar?.parseCookies(res.headers.getSetCookie());
59
60 return res;
61 });
62 }
63}

Callers 2

doPollMethod · 0.95
doWriteMethod · 0.95

Calls 3

appendCookiesMethod · 0.80
parseCookiesMethod · 0.80
uriMethod · 0.45

Tested by

no test coverage detected