in bindings/akamai/src/index.ts [218:240]
constructor(base: string | HttpResponse, status?: number, headers?: Record<string, string>) {
if (typeof base === "string") {
this._body = base;
this._status = status ?? 200;
this.headers = new Map();
for (const [key, value] of Object.entries(headers ?? {})) {
if (Array.isArray(value)) {
this.headers.set(key.toLowerCase(), value);
} else {
this.headers.set(key.toLowerCase(), [value]);
}
}
} else {
// base type is HttpResponse
this._body = base.body;
this._status = status ?? base.status;
this.headers = new Map();
let rh = base.getHeaders();
for (const key in rh) {
this.headers.set(key.toLowerCase(), rh[key]);
}
}
}