Skip to content

Commit

Permalink
Fixed bug where NotAuthorized error returned 403 instead of 401
Browse files Browse the repository at this point in the history
  • Loading branch information
coen-hyde committed Mar 15, 2012
1 parent 9356bb8 commit 869d72f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/journey/errors.js
Expand Up @@ -30,7 +30,7 @@ this.NotImplemented = function (msg) {
this.body = { error: msg }; this.body = { error: msg };
}; };
this.NotAuthorized = function (msg) { this.NotAuthorized = function (msg) {
this.status = 403; this.status = 401;
this.headers = {}; this.headers = {};
this.body = { error: msg || 'Not Authorized' }; this.body = { error: msg || 'Not Authorized' };
}; };
12 changes: 6 additions & 6 deletions test/journey-test.js
Expand Up @@ -383,8 +383,8 @@ vows.describe('Journey').addBatch({
topic: function () { topic: function () {
return get('/this_is/secure'); return get('/this_is/secure');
}, },
"returns a 403": function (res) { "returns a 401": function (res) {
assert.equal(res.status, 403); assert.equal(res.status, 401);
}, },
"returns a body with 'Not Authorized'": function (res) { "returns a body with 'Not Authorized'": function (res) {
assert.equal(res.body.error, 'Not Authorized'); assert.equal(res.body.error, 'Not Authorized');
Expand All @@ -410,8 +410,8 @@ vows.describe('Journey').addBatch({
topic: function () { topic: function () {
return get('/this_is/still_secure'); return get('/this_is/still_secure');
}, },
"returns a 403": function (res) { "returns a 401": function (res) {
assert.equal(res.status, 403); assert.equal(res.status, 401);
}, },
"returns a body with 'Not Authorized'": function (res) { "returns a body with 'Not Authorized'": function (res) {
assert.equal(res.body.error, 'Not Authorized'); assert.equal(res.body.error, 'Not Authorized');
Expand All @@ -437,8 +437,8 @@ vows.describe('Journey').addBatch({
topic: function () { topic: function () {
return get('/scoped_auth/secure'); return get('/scoped_auth/secure');
}, },
"returns a 403": function (res) { "returns a 401": function (res) {
assert.equal(res.status, 403); assert.equal(res.status, 401);
}, },
"returns a body with 'Not Authorized'": function (res) { "returns a body with 'Not Authorized'": function (res) {
assert.equal(res.body.error, 'Not Authorized'); assert.equal(res.body.error, 'Not Authorized');
Expand Down

0 comments on commit 869d72f

Please sign in to comment.