Comparing version
import { ResponseType, Response, ParseJsonFunction } from './types'; | ||
declare const parseBody: (response: Response, responseType: ResponseType, parseJson: ParseJsonFunction, encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined) => unknown; | ||
declare const parseBody: (response: Response, responseType: ResponseType, parseJson: ParseJsonFunction, encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex" | undefined) => unknown; | ||
export default parseBody; |
@@ -24,2 +24,3 @@ "use strict"; | ||
this.name = 'ParseError'; | ||
this.code = this.code === 'ERR_GOT_REQUEST_ERROR' ? 'ERR_BODY_PARSE_FAILURE' : this.code; | ||
} | ||
@@ -35,2 +36,3 @@ } | ||
this.name = 'CancelError'; | ||
this.code = 'ERR_CANCELED'; | ||
} | ||
@@ -37,0 +39,0 @@ get isCanceled() { |
@@ -955,3 +955,3 @@ /// <reference types="node" /> | ||
export declare class RequestError extends Error { | ||
code?: string; | ||
code: string; | ||
stack: string; | ||
@@ -958,0 +958,0 @@ readonly options: NormalizedOptions; |
@@ -229,18 +229,19 @@ /// <reference types="node" /> | ||
/** | ||
An error to be thrown when a cache method fails. | ||
For example, if the database goes down or there's a filesystem error. | ||
An error to be thrown when a cache method fails. For example, if the database goes down or there's a filesystem error. | ||
Contains a `code` property with `ERR_CACHE_ACCESS` or a more specific failure code. | ||
*/ | ||
CacheError: typeof CacheError; | ||
/** | ||
An error to be thrown when a request fails. | ||
Contains a `code` property with error class code, like `ECONNREFUSED`. | ||
An error to be thrown when a request fails. Contains a `code` property with error class code, like `ECONNREFUSED`. | ||
If there is no specific code supplied, `code` defaults to `ERR_GOT_REQUEST_ERROR`. | ||
*/ | ||
RequestError: typeof RequestError; | ||
/** | ||
An error to be thrown when reading from response stream fails. | ||
An error to be thrown when reading from response stream fails. Contains a `code` property with | ||
`ERR_READING_RESPONSE_STREAM` or a more specific failure code. | ||
*/ | ||
ReadError: typeof ReadError; | ||
/** | ||
An error to be thrown when server response code is 2xx, and parsing body fails. | ||
Includes a `response` property. | ||
An error to be thrown when server response code is 2xx, and parsing body fails. Includes a | ||
`response` property. Contains a `code` property with `ERR_BODY_PARSE_FAILURE` or a more specific failure code. | ||
*/ | ||
@@ -250,3 +251,3 @@ ParseError: typeof ParseError; | ||
An error to be thrown when the server response code is not 2xx nor 3xx if `options.followRedirect` is `true`, but always except for 304. | ||
Includes a `response` property. | ||
Includes a `response` property. Contains a `code` property with `ERR_NON_2XX_3XX_RESPONSE` or a more specific failure code. | ||
*/ | ||
@@ -256,7 +257,7 @@ HTTPError: typeof HTTPError; | ||
An error to be thrown when the server redirects you more than ten times. | ||
Includes a `response` property. | ||
Includes a `response` property. Contains a `code` property with `ERR_TOO_MANY_REDIRECTS`. | ||
*/ | ||
MaxRedirectsError: typeof MaxRedirectsError; | ||
/** | ||
An error to be thrown when given an unsupported protocol. | ||
An error to be thrown when given an unsupported protocol. Contains a `code` property with `ERR_UNSUPPORTED_PROTOCOL`. | ||
*/ | ||
@@ -266,3 +267,3 @@ UnsupportedProtocolError: typeof UnsupportedProtocolError; | ||
An error to be thrown when the request is aborted due to a timeout. | ||
Includes an `event` and `timings` property. | ||
Includes an `event` and `timings` property. Contains a `code` property with `ETIMEDOUT`. | ||
*/ | ||
@@ -272,6 +273,7 @@ TimeoutError: typeof TimeoutError; | ||
An error to be thrown when the request body is a stream and an error occurs while reading from that stream. | ||
Contains a `code` property with `ERR_UPLOAD` or a more specific failure code. | ||
*/ | ||
UploadError: typeof UploadError; | ||
/** | ||
An error to be thrown when the request is aborted with `.cancel()`. | ||
An error to be thrown when the request is aborted with `.cancel()`. Contains a `code` property with `ERR_CANCELED`. | ||
*/ | ||
@@ -278,0 +280,0 @@ CancelError: typeof CancelError; |
{ | ||
"name": "got", | ||
"version": "11.8.2", | ||
"version": "11.8.3", | ||
"description": "Human-friendly and powerful HTTP request library for Node.js", | ||
@@ -51,3 +51,3 @@ "license": "MIT", | ||
"cacheable-lookup": "^5.0.3", | ||
"cacheable-request": "^7.0.1", | ||
"cacheable-request": "^7.0.2", | ||
"decompress-response": "^6.0.0", | ||
@@ -54,0 +54,0 @@ "http2-wrapper": "^1.0.0-beta.5.2", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
268493
0.79%4275
0.23%2478
0.04%Updated