Skip to content

Commit a5beb5b

Browse files
committed
Fixed cors headers.
1 parent aaf56be commit a5beb5b

4 files changed

Lines changed: 4 additions & 2 deletions

File tree

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ Framework.prototype.cors = function(url, flags, credentials) {
11371137
methods.push(flag.toUpperCase());
11381138
break;
11391139
default:
1140-
headers.push(flag);
1140+
headers.push(flags[i]);
11411141
break;
11421142
}
11431143
}

test/controllers/default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ exports.install = function() {
145145
framework.cors('/api/*');
146146
framework.cors('/cors/origin-all/');
147147
framework.cors('/cors/origin-not/', ['http://www.petersirka.eu', 'http://www.858project.com']);
148-
framework.cors('/cors/headers/', ['post', 'put', 'delete', 'options'], true);
148+
framework.cors('/cors/headers/', ['post', 'put', 'delete', 'options', 'X-Ping'], true);
149149
};
150150

151151
function plain_options() {

test/test-framework-debug.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ function test_routing(next) {
151151
assert.ok(headers['access-control-allow-origin'] === 'http://www.petersirka.eu', 'CORS, headers problem 1');
152152
assert.ok(headers['access-control-allow-credentials'] === 'true', 'CORS, headers problem 2');
153153
assert.ok(headers['access-control-allow-methods'] === 'POST, PUT, DELETE, OPTIONS', 'CORS, headers problem 3');
154+
assert.ok(headers['access-control-allow-headers'] === 'X-Ping', 'CORS, headers problem 4');
154155
complete();
155156
}, null, { 'origin': 'http://www.petersirka.eu' });
156157
});

test/test-framework-release.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ function test_routing(next) {
151151
assert.ok(headers['access-control-allow-origin'] === 'http://www.petersirka.eu', 'CORS, headers problem 1');
152152
assert.ok(headers['access-control-allow-credentials'] === 'true', 'CORS, headers problem 2');
153153
assert.ok(headers['access-control-allow-methods'] === 'POST, PUT, DELETE, OPTIONS', 'CORS, headers problem 3');
154+
assert.ok(headers['access-control-allow-headers'] === 'X-Ping', 'CORS, headers problem 4');
154155
complete();
155156
}, null, { 'origin': 'http://www.petersirka.eu' });
156157
});

0 commit comments

Comments
 (0)