Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to override Content-Type header for responses #119

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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