Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed bug where NotAuthorized error returned 403 instead of 401

  • Loading branch information...
commit 869d72f609d44c6b77e5a10e0d4efc76c5ecd17e 1 parent 9356bb8
Coen Hyde authored
2  lib/journey/errors.js
@@ -30,7 +30,7 @@ this.NotImplemented = function (msg) {
30 30
     this.body = { error: msg };
31 31
 };
32 32
 this.NotAuthorized = function (msg) {
33  
-    this.status = 403;
  33
+    this.status = 401;
34 34
     this.headers = {};
35 35
     this.body = { error: msg || 'Not Authorized' };
36 36
 };
12  test/journey-test.js
@@ -383,8 +383,8 @@ vows.describe('Journey').addBatch({
383 383
                 topic: function () {
384 384
                     return get('/this_is/secure');
385 385
                 },
386  
-                "returns a 403": function (res) {
387  
-                    assert.equal(res.status, 403);
  386
+                "returns a 401": function (res) {
  387
+                    assert.equal(res.status, 401);
388 388
                 },
389 389
                 "returns a body with 'Not Authorized'": function (res) {
390 390
                     assert.equal(res.body.error, 'Not Authorized');
@@ -410,8 +410,8 @@ vows.describe('Journey').addBatch({
410 410
                 topic: function () {
411 411
                     return get('/this_is/still_secure');
412 412
                 },
413  
-                "returns a 403": function (res) {
414  
-                    assert.equal(res.status, 403);
  413
+                "returns a 401": function (res) {
  414
+                    assert.equal(res.status, 401);
415 415
                 },
416 416
                 "returns a body with 'Not Authorized'": function (res) {
417 417
                     assert.equal(res.body.error, 'Not Authorized');
@@ -437,8 +437,8 @@ vows.describe('Journey').addBatch({
437 437
                 topic: function () {
438 438
                     return get('/scoped_auth/secure');
439 439
                 },
440  
-                "returns a 403": function (res) {
441  
-                    assert.equal(res.status, 403);
  440
+                "returns a 401": function (res) {
  441
+                    assert.equal(res.status, 401);
442 442
                 },
443 443
                 "returns a body with 'Not Authorized'": function (res) {
444 444
                     assert.equal(res.body.error, 'Not Authorized');

0 notes on commit 869d72f

Please sign in to comment.
Something went wrong with that request. Please try again.