File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
packages/open-next/src/overrides/converters Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,22 @@ const converter: Converter<InternalEvent, InternalResult | MiddlewareResult> = {
78
78
}
79
79
const headers = new Headers ( ) ;
80
80
for ( const [ key , value ] of Object . entries ( result . headers ) ) {
81
- headers . set ( key , Array . isArray ( value ) ? value . join ( "," ) : value ) ;
81
+ if ( key === "set-cookie" && typeof value === "string" ) {
82
+ // If the value is a string, we need to parse it into an array
83
+ // This is the case for middleware direct result
84
+ const cookies = parseCookies ( value ) ;
85
+ for ( const cookie of cookies ) {
86
+ headers . append ( key , cookie ) ;
87
+ }
88
+ continue ;
89
+ }
90
+ if ( Array . isArray ( value ) ) {
91
+ for ( const v of value ) {
92
+ headers . append ( key , v ) ;
93
+ }
94
+ } else {
95
+ headers . set ( key , value ) ;
96
+ }
82
97
}
83
98
84
99
return new Response ( result . body as ReadableStream , {
You can’t perform that action at this time.
0 commit comments