File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
packages/adapter-netlify/files Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export async function handler(event) {
2929 return {
3030 isBase64Encoded : false ,
3131 statusCode : rendered . status ,
32- ...splitHeaders ( headers , 'set-cookie' ) ,
32+ ...splitHeaders ( headers ) ,
3333 body : rendered . body
3434 } ;
3535 }
@@ -43,20 +43,18 @@ export async function handler(event) {
4343/**
4444 * Splits headers into two categories: single value and multi value
4545 * @param {Record<string, string | string[]> } headers
46- * @param {...string } fields
4746 * @returns {{
4847 * headers: Record<string, string>,
4948 * multiValueHeaders: Record<string, string[]>
5049 * }}
5150 */
52- function splitHeaders ( headers , ... fields ) {
53- const h = { ... headers } ;
51+ function splitHeaders ( headers ) {
52+ const h = { } ;
5453 const m = { } ;
55- for ( const field of fields ) {
56- if ( Array . isArray ( h [ field ] ) ) {
57- m [ field ] = h [ field ] ;
58- delete h [ field ] ;
59- }
54+ for ( const key in headers ) {
55+ const value = headers [ key ] ;
56+ const target = Array . isArray ( value ) ? m : h ;
57+ target [ key ] = value ;
6058 }
6159 return {
6260 headers : h ,
You can’t perform that action at this time.
0 commit comments