Update content-length calculation to use buffer
This commit is contained in:
parent
bea48602f5
commit
a779ec1d09
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@extollo/lib",
|
"name": "@extollo/lib",
|
||||||
"version": "0.9.20",
|
"version": "0.9.21",
|
||||||
"description": "The framework library that lifts up your code.",
|
"description": "The framework library that lifts up your code.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
@ -243,7 +243,7 @@ export class Response {
|
|||||||
await this.sending$.next(this)
|
await this.sending$.next(this)
|
||||||
|
|
||||||
if ( !(this.body instanceof Readable) ) {
|
if ( !(this.body instanceof Readable) ) {
|
||||||
this.setHeader('Content-Length', String((this.body?.length ?? 0) + 2))
|
this.setHeader('Content-Length', String(Buffer.from(this.body ?? '').length))
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setHeader('Date', (new Date()).toUTCString())
|
this.setHeader('Date', (new Date()).toUTCString())
|
||||||
|
Loading…
Reference in New Issue
Block a user