Skip to content

Commit

Permalink
Adds a block on DELETE requests in status 300-400
Browse files Browse the repository at this point in the history
The request carries write consequences so POST, PUT and DELETE are blocked.
  • Loading branch information
goatslacker committed Feb 27, 2012
1 parent 14989b2 commit 21bf78c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ Request.prototype.start = function () {

if (response.statusCode >= 300 && response.statusCode < 400 &&
(self.followAllRedirects ||
(self.followRedirect && (self.method !== 'PUT' && self.method !== 'POST'))) &&
(self.followRedirect && (self.method !== 'PUT' && self.method !== 'POST' && self.method !== 'DELETE'))) &&
response.headers.location) {
if (self._redirectsFollowed >= self.maxRedirects) {
self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop."))
Expand Down

0 comments on commit 21bf78c

Please sign in to comment.