Permalink
Browse files

ios: allow application/javascript and text/javascript for packager bu…

…ndle mime type

Summary: When loading bundle from packager, "application/javascript" and "text/javascript" both refer to JS, so let's allow both for now.

Reviewed By: javache

Differential Revision: D5499446

fbshipit-source-id: f0b42e2fe5dc043a68d2c8df6a9f81e6dd995b57
  • Loading branch information...
fkgozali authored and facebook-github-bot committed Jul 26, 2017
1 parent 6d57726 commit 314934835827ef29ebaadb582f34b2dc1a597492
Showing with 4 additions and 2 deletions.
  1. +4 −2 React/Base/RCTJavaScriptLoader.mm
@@ -246,11 +246,13 @@ static void attemptAsynchronousLoadOfBundleAtURL(NSURL *scriptURL, RCTSourceLoad
// Validate that the packager actually returned javascript.
NSString *contentType = headers[@"Content-Type"];
if (![contentType isEqualToString:@"application/javascript"]) {
if (![contentType isEqualToString:@"application/javascript"] &&
![contentType isEqualToString:@"text/javascript"]) {
NSString *description = [NSString stringWithFormat:@"Expected Content-Type to be 'application/javascript' or 'text/javascript', but got '%@'.", contentType];
error = [NSError errorWithDomain:@"JSServer"
code:NSURLErrorCannotParseResponse
userInfo:@{
NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Expected JavaScript, but got content type '%@'.", contentType],
NSLocalizedDescriptionKey: description,
@"headers": headers,
@"data": data
}];

0 comments on commit 3149348

Please sign in to comment.