Skip to content

Commit

Permalink
add 307,308 to redirect assertion #147
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Metzidis committed Mar 13, 2017
1 parent 3a37080 commit 7eef16a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/http.js
Expand Up @@ -244,13 +244,13 @@ module.exports = function (chai, _) {
*/

Assertion.addProperty('redirect', function() {
var redirectCodes = [301, 302, 303]
var redirectCodes = [301, 302, 303, 307, 308]
, status = this._obj.status
, redirects = this._obj.redirects;

this.assert(
redirectCodes.indexOf(status) >= 0 || redirects && redirects.length
, "expected redirect with 30{1-3} status code but got " + status
redirectCodes.indexOf(status) >= 0 || redirects && redirects.length
,"expected redirect status code but got " + status
, "expected not to redirect but got " + status + " status"
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/http.js
Expand Up @@ -177,7 +177,7 @@ describe('assertions', function () {
var res = { status: 200 };
res.should.not.redirect;

[301, 302, 303].forEach(function (status) {
[301, 302, 303,307,308].forEach(function (status) {
var res = { status: status };
res.should.redirect;
});
Expand All @@ -195,7 +195,7 @@ describe('assertions', function () {
(function () {
var res = { status: 200 };
res.should.redirect;
}).should.throw('expected redirect with 30{1-3} status code but got 200');
}).should.throw('expected redirect status code but got 200');

(function () {
var res = { status: 301 };
Expand Down

0 comments on commit 7eef16a

Please sign in to comment.