cast headers to lower cases

This commit is contained in:
fyears 2022-04-10 11:05:37 +08:00
parent be1386b345
commit 0cf8023278

View File

@ -109,6 +109,11 @@ class ObsHttpHandler extends FetchHttpHandler {
const raceOfPromises = [ const raceOfPromises = [
requestUrl(param).then((rsp) => { requestUrl(param).then((rsp) => {
const headers = rsp.headers;
const headersLower: Record<string, string> = {};
for (const key of Object.keys(headers)) {
headersLower[key.toLowerCase()] = headers[key];
}
const stream = new ReadableStream<Uint8Array>({ const stream = new ReadableStream<Uint8Array>({
start(controller) { start(controller) {
controller.enqueue(new Uint8Array(rsp.arrayBuffer)); controller.enqueue(new Uint8Array(rsp.arrayBuffer));
@ -117,7 +122,7 @@ class ObsHttpHandler extends FetchHttpHandler {
}); });
return { return {
response: new HttpResponse({ response: new HttpResponse({
headers: rsp.headers, headers: headersLower,
statusCode: rsp.status, statusCode: rsp.status,
body: stream, body: stream,
}), }),