Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Accept all 2xx and 3xx HTTP status codes as successful #228

Merged
merged 2 commits into from
May 22, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/pollers/http/baseHttpPoller.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ BaseHttpPoller.prototype.setUserAgent = function(userAgent) {
* @api private
*/
BaseHttpPoller.prototype.onResponseCallback = function(res) {
var statusCode = res.statusCode;
if (statusCode == 301 || statusCode == 302 || statusCode == 303 || statusCode == 307) {
var statusCode = res.statusCode.toString();
if (statusCode.match(/3\d{2}/)) {
return this.handleRedirectResponse(res); // abstract, see implementations in http and https
}
if (statusCode != 200) {
if (statusCode.match(/2\d{2}/) === null) {
return this.handleErrorResponse(res);
}
this.handleOkResponse(res);
Expand Down