Skip to content

Commit 12a49be

Browse files
committed
ensure that passed in headers can override CORS headers
1 parent 1a4657a commit 12a49be

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/server-response.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ class ServerResponse {
7272
'Content-Type': 'application/json'
7373
};
7474

75-
if (data) {
76-
headers = Object.assign(headers, data.headers);
77-
}
78-
7975
let response = Object.assign(this.createResponseObject(code), data || {});
8076
if (this.corsEnabled) {
8177
headers = Object.assign(headers, this.corsHeaders);
8278
}
8379

80+
if (data) {
81+
headers = Object.assign(headers, data.headers);
82+
}
83+
8484
let responseString = JSON.stringify(response);
8585
headers['Content-Length'] = Buffer.byteLength(responseString);
8686

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hydra",
3-
"version": "1.8.0",
3+
"version": "1.8.1",
44
"license": "MIT",
55
"author": "Carlos Justiniano",
66
"contributors": "https://github.com/pnxtech/hydra/graphs/contributors",
@@ -36,8 +36,8 @@
3636
"eslint": "4.18.2",
3737
"eslint-config-google": "0.7.1",
3838
"eslint-plugin-mocha": "4.9.0",
39-
"mocha": "^8.1.3",
40-
"nyc": "^15.1.0",
39+
"mocha": "8.1.3",
40+
"nyc": "15.1.0",
4141
"redis-mock": "0.17.0"
4242
},
4343
"nyc": {

0 commit comments

Comments
 (0)