in bindings/akamai/src/index.ts [149:172]
constructor(req: EW.ResponseProviderRequest | string, options?: AkamaiRequestInit) {
if (typeof req === "string") {
this.url_ = req;
this.method_ = options?.method ?? "GET";
this.body_ = options?.body ?? "";
this.headers = new Map();
for (const [key, value] of Object.entries(options?.headers ?? {})) {
if (typeof value === "string") {
this.headers.set(key.toLowerCase(), value);
} else {
this.headers.set(key.toLowerCase(), value.join(","));
}
}
} else {
this.req = req;
this.url_ = `${this.req.scheme}://${this.req.host}${this.req.path}`;
this.method_ = this.req.method;
this.headers = new Map();
let headers = req.getHeaders();
for (const [key, value] of Object.entries(headers)) {
this.headers.set(key.toLowerCase(), value.join(","));
}
}
}