Skip to content

Commit 1ea9265

Browse files
authored
Merge pull request #154 from tonymet/issue/147
add 307,308 to redirect assertion #147
2 parents 3a37080 + ad0c3be commit 1ea9265

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/http.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,13 @@ module.exports = function (chai, _) {
244244
*/
245245

246246
Assertion.addProperty('redirect', function() {
247-
var redirectCodes = [301, 302, 303]
247+
var redirectCodes = [301, 302, 303, 307, 308]
248248
, status = this._obj.status
249249
, redirects = this._obj.redirects;
250250

251251
this.assert(
252252
redirectCodes.indexOf(status) >= 0 || redirects && redirects.length
253-
, "expected redirect with 30{1-3} status code but got " + status
253+
, "expected redirect with 30X status code but got " + status
254254
, "expected not to redirect but got " + status + " status"
255255
);
256256
});

test/http.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ describe('assertions', function () {
177177
var res = { status: 200 };
178178
res.should.not.redirect;
179179

180-
[301, 302, 303].forEach(function (status) {
180+
[301, 302, 303, 307, 308].forEach(function (status) {
181181
var res = { status: status };
182182
res.should.redirect;
183183
});
@@ -195,7 +195,7 @@ describe('assertions', function () {
195195
(function () {
196196
var res = { status: 200 };
197197
res.should.redirect;
198-
}).should.throw('expected redirect with 30{1-3} status code but got 200');
198+
}).should.throw('expected redirect with 30X status code but got 200');
199199

200200
(function () {
201201
var res = { status: 301 };

0 commit comments

Comments
 (0)