Skip to content

Commit 2db432a

Browse files
committed
fix(http): normalize header keys to be case insensitive in request builder
1 parent 0d520ef commit 2db432a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/http/src/model.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,14 @@ export class RequestBuilder {
313313
}
314314

315315
headers(headers: { [name: string]: string }): this {
316-
this._headers = headers;
316+
this._headers = Object.fromEntries(
317+
Object.entries(headers).map(([key, value]) => [key.toLowerCase(), value])
318+
);
317319
return this;
318320
}
319321

320322
header(name: string, value: string | number): this {
321-
this._headers[name] = String(value);
323+
this._headers[name.toLowerCase()] = String(value);
322324
return this;
323325
}
324326

@@ -557,4 +559,4 @@ export class MemoryHttpResponse extends HttpResponse {
557559
this.emit('close');
558560
return this;
559561
}
560-
}
562+
}

0 commit comments

Comments
 (0)