Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
alexxpoch committed Nov 15, 2018
1 parent e53fc5f commit 70cc313
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/httpServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ module.exports = function(provider, logger) {
"Access-Control-Allow-Methods": "*"
};

if (request.headers.hasOwnProperty("access-control-request-headers")) {
headers["Access-Control-Allow-Headers"] = request.headers["access-control-request-headers"];
}

switch (method) {
case "OPTIONS":
headers["Content-Type"] = "text/plain";
Expand Down Expand Up @@ -58,12 +62,8 @@ module.exports = function(provider, logger) {

break;
default:
response.writeHead(400, {
"Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept, User-Agent",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "*",
"Content-Type": "text/plain"
});
headers["Content-Type"] = "text/plain";
response.writeHead(400, headers);
response.end("400 Bad Request");
break;
}
Expand Down

0 comments on commit 70cc313

Please sign in to comment.