[Packager] Include Content-Type headers with bundle and source maps

Summary:
The packager did not send back the Content-Type headers. Adding these.

Closes https://github.com/facebook/react-native/pull/2029
Github Author: James Ide <ide@jameside.com>
This commit is contained in:
James Ide 2015-07-24 18:31:41 -07:00
parent 5f0317291b
commit 53222f0dda
2 changed files with 8 additions and 3 deletions

View File

@ -39,6 +39,7 @@ describe('processRequest', function() {
requestHandler(
{ url: requrl },
{
setHeader: jest.genMockFunction(),
end: function(res) {
resolve(res);
}

View File

@ -358,13 +358,17 @@ Server.prototype.processRequest = function(req, res, next) {
building.then(
function(p) {
if (requestType === 'bundle') {
res.end(p.getSource({
var bundleSource = p.getSource({
inlineSourceMap: options.inlineSourceMap,
minify: options.minify,
}));
});
res.setHeader('Content-Type', 'application/javascript');
res.end(bundleSource);
Activity.endEvent(startReqEventId);
} else if (requestType === 'map') {
res.end(JSON.stringify(p.getSourceMap()));
var sourceMap = JSON.stringify(p.getSourceMap());
res.setHeader('Content-Type', 'application/json');
res.end(sourceMap);
Activity.endEvent(startReqEventId);
}
},