From aceed32d4df3a7720a5729383743cac9ac7c4612 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 20 Dec 2016 18:38:34 +0700 Subject: [PATCH] Don't throw HTTPError on 304 responses --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 2f5bfb0..a3bc784 100644 --- a/index.js +++ b/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); } @@ -185,7 +185,7 @@ function asStream(opts) { 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); return; }