File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ export async function index(context) {
2929 const request = toRequest ( context ) ;
3030
3131 if ( debug ) {
32+ context . log (
33+ 'Starting request' ,
34+ context ?. req ?. method ,
35+ context ?. req ?. headers ?. [ 'x-ms-original-url' ]
36+ ) ;
37+ context . log ( `Original request: ${ JSON . stringify ( context ) } ` ) ;
3238 context . log ( `Request: ${ JSON . stringify ( request ) } ` ) ;
3339 }
3440
@@ -66,6 +72,12 @@ function toRequest(context) {
6672 // this header contains the URL the user requested
6773 const originalUrl = headers [ 'x-ms-original-url' ] ;
6874
75+ // SWA strips content-type headers from empty POST requests, but SK form actions require the header
76+ // https://github.com/geoffrich/svelte-adapter-azure-swa/issues/178
77+ if ( method === 'POST' && ! body && ! headers [ 'content-type' ] ) {
78+ headers [ 'content-type' ] = 'application/x-www-form-urlencoded' ;
79+ }
80+
6981 /** @type {RequestInit } */
7082 const init = {
7183 method,
You can’t perform that action at this time.
0 commit comments