File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
packages/open-next/src/http Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @opennextjs/aws " : patch
3
+ ---
4
+
5
+ fix(http): Set content-length only if body is present
6
+
7
+ The body is undefined when using the edge converter and the method is GET or HEAD
Original file line number Diff line number Diff line change @@ -28,8 +28,10 @@ export class IncomingMessage extends http.IncomingMessage {
28
28
destroy : Function . prototype ,
29
29
} ) ;
30
30
31
- if ( typeof headers [ "content-length" ] === "undefined" ) {
32
- headers [ "content-length" ] = Buffer . byteLength ( body ) . toString ( ) ;
31
+ // Set the content length when there is a body.
32
+ // See https://httpwg.org/specs/rfc9110.html#field.content-length
33
+ if ( body ) {
34
+ headers [ "content-length" ] ??= String ( Buffer . byteLength ( body ) ) ;
33
35
}
34
36
35
37
Object . assign ( this , {
You can’t perform that action at this time.
0 commit comments