Browse Source

Don't throw HTTPError on 304 responses

allow-304
Luke Childs 8 years ago
parent
commit
aceed32d4d
  1. 4
      index.js

4
index.js

@ -126,7 +126,7 @@ function asPromise(opts) {
} }
} }
if (statusCode < 200 || statusCode > limitStatusCode) { if (statusCode !== 304 && (statusCode < 200 || statusCode > limitStatusCode)) {
throw new got.HTTPError(statusCode, opts); throw new got.HTTPError(statusCode, opts);
} }
@ -185,7 +185,7 @@ function asStream(opts) {
res.pipe(output); res.pipe(output);
if (statusCode < 200 || statusCode > 299) { if (statusCode !== 304 && (statusCode < 200 || statusCode > 299)) {
proxy.emit('error', new got.HTTPError(statusCode, opts), null, res); proxy.emit('error', new got.HTTPError(statusCode, opts), null, res);
return; return;
} }

Loading…
Cancel
Save