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) {
29
29
const request = toRequest ( context ) ;
30
30
31
31
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 ) } ` ) ;
32
38
context . log ( `Request: ${ JSON . stringify ( request ) } ` ) ;
33
39
}
34
40
@@ -66,6 +72,12 @@ function toRequest(context) {
66
72
// this header contains the URL the user requested
67
73
const originalUrl = headers [ 'x-ms-original-url' ] ;
68
74
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
+
69
81
/** @type {RequestInit } */
70
82
const init = {
71
83
method,
You can’t perform that action at this time.
0 commit comments