mirror of https://github.com/status-im/metro.git
[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:
parent
4b7f9c60c4
commit
03b4050c6e
|
@ -39,6 +39,7 @@ describe('processRequest', function() {
|
||||||
requestHandler(
|
requestHandler(
|
||||||
{ url: requrl },
|
{ url: requrl },
|
||||||
{
|
{
|
||||||
|
setHeader: jest.genMockFunction(),
|
||||||
end: function(res) {
|
end: function(res) {
|
||||||
resolve(res);
|
resolve(res);
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,13 +358,17 @@ Server.prototype.processRequest = function(req, res, next) {
|
||||||
building.then(
|
building.then(
|
||||||
function(p) {
|
function(p) {
|
||||||
if (requestType === 'bundle') {
|
if (requestType === 'bundle') {
|
||||||
res.end(p.getSource({
|
var bundleSource = p.getSource({
|
||||||
inlineSourceMap: options.inlineSourceMap,
|
inlineSourceMap: options.inlineSourceMap,
|
||||||
minify: options.minify,
|
minify: options.minify,
|
||||||
}));
|
});
|
||||||
|
res.setHeader('Content-Type', 'application/javascript');
|
||||||
|
res.end(bundleSource);
|
||||||
Activity.endEvent(startReqEventId);
|
Activity.endEvent(startReqEventId);
|
||||||
} else if (requestType === 'map') {
|
} 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);
|
Activity.endEvent(startReqEventId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue