-
Notifications
You must be signed in to change notification settings - Fork 60
Description
Describe the bug
Empty POST requests to the API of an Azure Static Web App have the content-type header removed.
To Reproduce
- create an Azure Function in your SWA that handles POST requests
- inspect the content-type header received by that function (either by logging or by returning the value)
- if the POST request has no body, the content-type header is not present. This is despite the content-type header being present on the original request from the browser
Click "submit" on the empty form. The response from the Azure function shows that no content-type header was passed to the function handler. However, if you inspect the request sent from the browser, the content-type header was sent -- so something is removing the header before it gets to the Azure function.

Submitting the second form (which has a form body) does not strip the content-type header.
Expected behavior
I expect the Azure function to receive the same content-type header that was sent from the browser.
Device info (if applicable):
n/a
Additional context
I maintain an Azure SWA adapter for SvelteKit and this behavior caused this issue.
This appears to be SWA specific, instead of a more general Azure function problem. I deployed the same Azure function code to a standalone function and it did not remove the content-type header.