Minify: Don't ignore request headers in `requestURI()`

pull/4765/head
Richard Hansen 2021-02-11 19:31:42 -05:00 committed by John McLear
parent 7a003cb9e2
commit 7efca7dc7d
1 changed files with 34 additions and 38 deletions

View File

@ -48,10 +48,7 @@ const LIBRARY_WHITELIST = [
// What follows is a terrible hack to avoid loop-back within the server. // What follows is a terrible hack to avoid loop-back within the server.
// TODO: Serve files from another service, or directly from the file system. // TODO: Serve files from another service, or directly from the file system.
const requestURI = async (url, method, headers) => { const requestURI = async (url, method, headers) => await new Promise((resolve, reject) => {
var headers = {};
return await new Promise((resolve, reject) => {
const parsedURL = urlutil.parse(url); const parsedURL = urlutil.parse(url);
let status = 500; let status = 500;
const content = []; const content = [];
@ -86,7 +83,6 @@ const requestURI = async (url, method, headers) => {
}; };
minify(mockRequest, mockResponse).catch(reject); minify(mockRequest, mockResponse).catch(reject);
}); });
};
const requestURIs = (locations, method, headers, callback) => { const requestURIs = (locations, method, headers, callback) => {
Promise.all(locations.map((loc) => requestURI(loc, method, headers))).then((responses) => { Promise.all(locations.map((loc) => requestURI(loc, method, headers))).then((responses) => {