-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Content-Type does not respect optional charset encoding for iOS RCTJavascriptLoader #15791
Comments
I just tripped over this when attempting to get Haul to make a build for react-native 0.48.2: callstack/haul#228 |
cc'ing @janicduplessis as he was cc'd on an Expo bug report. |
Up @janicduplessis, there are some commits in the history of this issue. Is any of them ready for merging? If yes, I can go ahead and cherry-pick into respective branches. |
The PR has not been merged yet #15792, let's cherry pick it once it is. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
@janicduplessis did this end up getting merged somewhere? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
react-native -v
: 0.42.0node -v
: v6.11.2npm -v
: 4.6.1yarn --version
: 0.27.5Steps to Reproduce
Content-Type
header that includes both the MIME Type and an optional character encoding as specified here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-TypeContent-Type
header as if the optional character encoding doesn't exist: https://github.com/facebook/react-native/blame/master/React/Base/RCTJavaScriptLoader.mm#L277Expected Behavior
The code should follow the specification of
Content-Type
and respect only MIMEType checking instead of strictly checking theContent-Type
header for an exact match on MIMEType.Per Apple documentation,
NSURLResponse
contains theMIMEType
field that should be checked forapplication/javascript
instead of checking the rawContent-Type
header: https://developer.apple.com/documentation/foundation/nsurlresponseActual Behavior
Though this was encountered while using Expo, the error is nonetheless coming from the
RCTJavaScriptLoader
Expected JavaScript, but got content type 'application/javascript; chartset=UTF-8'. Check that your internet connection is working.
Reproducible Demo
https://github.com/sysgears/apollo-universal-starter-kit
Follow starter instructions and checkout this commit: sysgears/apollo-universal-starter-kit@bbcd52a
The problem is worked around after this commit in the project.
The text was updated successfully, but these errors were encountered: