apify-client 3.0.0-beta.72 → 3.0.0-beta.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -280,7 +280,8 @@ export declare abstract class HttpClient {
|
|
|
280
280
|
* The inherited {@link call} needs it, so every transport has to implement it. Let the library's errors
|
|
281
281
|
* propagate unwrapped: {@link call} classifies them through {@link isRetryableTransportError} and
|
|
282
282
|
* {@link isTimeoutError}. Return error responses as they are too, the pipeline turns them into
|
|
283
|
-
* {@link ApifyApiError} and decides whether to retry.
|
|
283
|
+
* {@link ApifyApiError} and decides whether to retry. Reject when the connection drops before the body is
|
|
284
|
+
* complete: the pipeline takes a returned body as whole and does not retry one that fails to parse.
|
|
284
285
|
*
|
|
285
286
|
* @param request - The request to send, with the headers merged, the body serialized and the query encoded.
|
|
286
287
|
* @returns The response, with the body unread when `request.stream` is set and as raw bytes otherwise.
|
|
@@ -169,7 +169,8 @@ export class HttpClient {
|
|
|
169
169
|
* The inherited {@link call} needs it, so every transport has to implement it. Let the library's errors
|
|
170
170
|
* propagate unwrapped: {@link call} classifies them through {@link isRetryableTransportError} and
|
|
171
171
|
* {@link isTimeoutError}. Return error responses as they are too, the pipeline turns them into
|
|
172
|
-
* {@link ApifyApiError} and decides whether to retry.
|
|
172
|
+
* {@link ApifyApiError} and decides whether to retry. Reject when the connection drops before the body is
|
|
173
|
+
* complete: the pipeline takes a returned body as whole and does not retry one that fails to parse.
|
|
173
174
|
*
|
|
174
175
|
* @param request - The request to send, with the headers merged, the body serialized and the query encoded.
|
|
175
176
|
* @returns The response, with the body unread when `request.stream` is set and as raw bytes otherwise.
|
|
@@ -357,12 +358,14 @@ export class HttpClient {
|
|
|
357
358
|
data = this.#parseResponseBody(response, config);
|
|
358
359
|
}
|
|
359
360
|
catch (err) {
|
|
360
|
-
//
|
|
361
|
-
|
|
362
|
-
|
|
361
|
+
// The body of a success arrived in full, since a transfer cut short fails in `sendRequest()`, so a
|
|
362
|
+
// retry would get the same body back.
|
|
363
|
+
if (response.status < 300) {
|
|
363
364
|
stopRetrying();
|
|
365
|
+
throw err;
|
|
364
366
|
}
|
|
365
|
-
|
|
367
|
+
// An error status is reported by its code, and `ApifyApiError` makes what it can of the raw body.
|
|
368
|
+
data = response.body;
|
|
366
369
|
}
|
|
367
370
|
const apifyResponse = {
|
|
368
371
|
status: response.status,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ApifyClientError } from './apify_client_error.js';
|
|
2
2
|
import type { HttpResponse } from './http_clients/base.js';
|
|
3
3
|
/**
|
|
4
|
-
* Thrown when a response
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Thrown when the body of a successful response does not parse as its content type claims, for example a non-JSON
|
|
5
|
+
* value stored under `application/json`. The response arrived in full, so the request is not retried. An error
|
|
6
|
+
* status with an unparsable body throws {@link ApifyApiError} for its status code.
|
|
7
7
|
*/
|
|
8
8
|
export declare class InvalidResponseBodyError extends ApifyClientError {
|
|
9
9
|
code: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ApifyClientError } from './apify_client_error.js';
|
|
2
2
|
/**
|
|
3
|
-
* Thrown when a response
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Thrown when the body of a successful response does not parse as its content type claims, for example a non-JSON
|
|
4
|
+
* value stored under `application/json`. The response arrived in full, so the request is not retried. An error
|
|
5
|
+
* status with an unparsable body throws {@link ApifyApiError} for its status code.
|
|
6
6
|
*/
|
|
7
7
|
export class InvalidResponseBodyError extends ApifyClientError {
|
|
8
8
|
code;
|