Comparing version 5.0.2 to 5.1.0
@@ -14,3 +14,3 @@ /// <reference types="node" /> | ||
} | ||
export declare type GaxiosPromise<T = any> = Promise<GaxiosResponse<T>>; | ||
export type GaxiosPromise<T = any> = Promise<GaxiosResponse<T>>; | ||
export interface GaxiosXMLHttpRequest { | ||
@@ -115,5 +115,11 @@ responseURL: string; | ||
noResponseRetries?: number; | ||
/** | ||
* Function to invoke which returns a promise. After the promise resolves, | ||
* the retry will be triggered. If provided, this will be used in-place of | ||
* the `retryDelay` | ||
*/ | ||
retryBackoff?: (err: GaxiosError, defaultBackoffMs: number) => Promise<void>; | ||
} | ||
export declare type FetchImplementation = (input: FetchRequestInfo, init?: FetchRequestInit) => Promise<FetchResponse>; | ||
export declare type FetchRequestInfo = any; | ||
export type FetchImplementation = (input: FetchRequestInfo, init?: FetchRequestInit) => Promise<FetchResponse>; | ||
export type FetchRequestInfo = any; | ||
export interface FetchResponse { | ||
@@ -120,0 +126,0 @@ readonly status: number; |
@@ -67,5 +67,7 @@ "use strict"; | ||
// Create a promise that invokes the retry after the backOffDelay | ||
const backoff = new Promise(resolve => { | ||
setTimeout(resolve, delay); | ||
}); | ||
const backoff = config.retryBackoff | ||
? config.retryBackoff(err, delay) | ||
: new Promise(resolve => { | ||
setTimeout(resolve, delay); | ||
}); | ||
// Notify the user if they added an `onRetryAttempt` handler | ||
@@ -72,0 +74,0 @@ if (config.onRetryAttempt) { |
# Changelog | ||
## [5.1.0](https://github.com/googleapis/gaxios/compare/v5.0.2...v5.1.0) (2023-03-06) | ||
### Features | ||
* Add support for custom backoff ([#498](https://github.com/googleapis/gaxios/issues/498)) ([4a34467](https://github.com/googleapis/gaxios/commit/4a344678110864d97818a8272ebcc5e1c4921b52)) | ||
## [5.0.2](https://github.com/googleapis/gaxios/compare/v5.0.1...v5.0.2) (2022-09-09) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "gaxios", | ||
"version": "5.0.2", | ||
"version": "5.1.0", | ||
"description": "A simple common HTTP client specifically for Google APIs and services.", | ||
@@ -42,3 +42,2 @@ "main": "build/src/index.js", | ||
"@types/cors": "^2.8.6", | ||
"@types/execa": "^0.9.0", | ||
"@types/express": "^4.16.1", | ||
@@ -50,7 +49,7 @@ "@types/extend": "^3.0.1", | ||
"@types/ncp": "^2.0.1", | ||
"@types/node": "^17.0.23", | ||
"@types/node": "^18.0.0", | ||
"@types/node-fetch": "^2.5.7", | ||
"@types/sinon": "^10.0.0", | ||
"@types/tmp": "0.2.3", | ||
"@types/uuid": "^8.0.0", | ||
"@types/uuid": "^9.0.0", | ||
"abort-controller": "^3.0.0", | ||
@@ -72,3 +71,3 @@ "assert": "^2.0.0", | ||
"karma-remap-coverage": "^0.1.5", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-sourcemap-loader": "^0.4.0", | ||
"karma-webpack": "^5.0.0", | ||
@@ -82,4 +81,4 @@ "linkinator": "^4.0.0", | ||
"null-loader": "^4.0.0", | ||
"puppeteer": "^17.0.0", | ||
"sinon": "^14.0.0", | ||
"puppeteer": "^18.0.0", | ||
"sinon": "^15.0.0", | ||
"stream-browserify": "^3.0.0", | ||
@@ -86,0 +85,0 @@ "tmp": "0.2.1", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70696
47
714