MCPcopy Create free account
hub / github.com/ccxt/ccxt / constructor

Method constructor

ts/src/static_dependencies/node-fetch/response.js:23–47  ·  view source on GitHub ↗
(body = null, options = {})

Source from the content-addressed store, hash-verified

21 */
22export default class Response extends Body {
23 constructor(body = null, options = {}) {
24 super(body, options);
25
26 // eslint-disable-next-line no-eq-null, eqeqeq, no-negated-condition
27 const status = options.status != null ? options.status : 200;
28
29 const headers = new Headers(options.headers);
30
31 if (body !== null && !headers.has('Content-Type')) {
32 const contentType = extractContentType(body, this);
33 if (contentType) {
34 headers.append('Content-Type', contentType);
35 }
36 }
37
38 this[INTERNALS] = {
39 type: 'default',
40 url: options.url,
41 status,
42 statusText: options.statusText || '',
43 headers,
44 counter: options.counter,
45 highWaterMark: options.highWaterMark
46 };
47 }
48
49 get type() {
50 return this[INTERNALS].type;

Callers

nothing calls this directly

Calls 2

extractContentTypeFunction · 0.90
appendMethod · 0.45

Tested by

no test coverage detected