mirror of
https://github.com/denoland/deno.git
synced 2024-12-26 17:19:06 -05:00
parent
2516281306
commit
2b360c60a5
1 changed files with 6 additions and 7 deletions
5
http.ts
5
http.ts
|
@ -89,13 +89,12 @@ interface Response {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setContentLength(r: Response): void {
|
function setContentLength(r: Response): void {
|
||||||
if (r.body) {
|
|
||||||
if (!r.headers) {
|
if (!r.headers) {
|
||||||
r.headers = new Headers();
|
r.headers = new Headers();
|
||||||
}
|
}
|
||||||
if (!r.headers.has("content-length")) {
|
if (!r.headers.has("content-length")) {
|
||||||
r.headers.append("Content-Length", r.body.byteLength.toString());
|
const bodyLength = r.body ? r.body.byteLength : 0
|
||||||
}
|
r.headers.append("Content-Length", bodyLength.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue