Skip to content

Conversation

@benpham2509
Copy link

Description

GCDWebServer provided the method that allows overriding the MIME types but react-native-static-server didn’t expose that capability, I added the optional mimeTypeOverrides argument to give the ability to override response’s Content-Type header.

Motivation and Context

When I tried to use this to set up our local server, it failed to set the correct Content-Type header for responses returning XML files. It sets application/octet-stream instead of application/xml as XMLHttpRequest expects.
The root cause is that GCDWebServer sets the response’s Content-Type header to application/octet-stream for all file types, except for a few well-known ones such as HTML or CSS. Therefore, I implemented a simple change as described above to set the correct Content-Type header for responses.

smellman added a commit to smellman/react-native-static-server that referenced this pull request Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant