File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -176,9 +176,25 @@ export default class VMRunner {
176176 throw new Error ( `Unsupported HTTP method: ${ method } ` ) ;
177177 }
178178
179+ // Convert AxiosHeaders to a plain object before serializing.
180+ // JSON.stringify calls AxiosHeaders.toJSON(key) with a truthy key,
181+ // which makes it join array headers (like set-cookie) with commas.
182+ // This produces invalid Cookie headers when user code forwards them.
183+ const plainHeaders : Record < string , unknown > = { } ;
184+
185+ if ( response . headers ) {
186+ for ( const key of Object . keys (
187+ response . headers as Record < string , unknown > ,
188+ ) ) {
189+ plainHeaders [ key ] = (
190+ response . headers as Record < string , unknown >
191+ ) [ key ] ;
192+ }
193+ }
194+
179195 return JSON . stringify ( {
180196 status : response . status ,
181- headers : response . headers ,
197+ headers : plainHeaders ,
182198 data : response . data ,
183199 } ) ;
184200 } ,
You can’t perform that action at this time.
0 commit comments