Skip to content

Commit

Permalink
drop the node-status-code dependency
Browse files Browse the repository at this point in the history
It was useful pre-v4, but now we're up to date.
  • Loading branch information
sindresorhus committed Nov 23, 2016
1 parent e1ca864 commit 98aa206
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const lowercaseKeys = require('lowercase-keys');
const isRedirect = require('is-redirect');
const unzipResponse = require('unzip-response');
const createErrorClass = require('create-error-class');
const nodeStatusCodes = require('node-status-codes');
const isRetryAllowed = require('is-retry-allowed');
const pkg = require('./package');

Expand Down Expand Up @@ -346,21 +345,21 @@ got.ReadError = createErrorClass('ReadError', stdError);
got.ParseError = createErrorClass('ParseError', function (e, statusCode, opts, data) {
stdError.call(this, e, opts);
this.statusCode = statusCode;
this.statusMessage = nodeStatusCodes[this.statusCode];
this.statusMessage = http.STATUS_CODES[this.statusCode];
this.message = `${e.message} in "${urlLib.format(opts)}": \n${data.slice(0, 77)}...`;
});

got.HTTPError = createErrorClass('HTTPError', function (statusCode, opts) {
stdError.call(this, {}, opts);
this.statusCode = statusCode;
this.statusMessage = nodeStatusCodes[this.statusCode];
this.statusMessage = http.STATUS_CODES[this.statusCode];
this.message = `Response code ${this.statusCode} (${this.statusMessage})`;
});

got.MaxRedirectsError = createErrorClass('MaxRedirectsError', function (statusCode, opts) {
stdError.call(this, {}, opts);
this.statusCode = statusCode;
this.statusMessage = nodeStatusCodes[this.statusCode];
this.statusMessage = http.STATUS_CODES[this.statusCode];
this.message = 'Redirected 10 times. Aborting.';
});

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"is-retry-allowed": "^1.0.0",
"is-stream": "^1.0.0",
"lowercase-keys": "^1.0.0",
"node-status-codes": "^2.0.0",
"timed-out": "^3.0.0",
"unzip-response": "^2.0.1",
"url-parse-lax": "^1.0.0"
Expand Down

0 comments on commit 98aa206

Please sign in to comment.