myfetchapi
Advanced tools
Comparing version 1.7.0 to 1.7.1
@@ -8,7 +8,26 @@ import type * as nodefetch from "node-fetch"; | ||
export type myFetchOptions = { | ||
/** | ||
* set this to `true` in order to use nodejs features, e.g agents | ||
*/ | ||
useNodeFetch?: boolean; | ||
/** | ||
* How many times a request will retry if it failed | ||
*/ | ||
maxRetry?: number | null; | ||
/** | ||
* callback is called when the http(s) request is retrying | ||
* @param err Error object | ||
* @param count retry count | ||
* @param max maxRetry | ||
* @returns any | ||
*/ | ||
retryCb?: (err: any, count: number, max: number) => any; | ||
/** | ||
* Normally the request is retried if the http(s) status isn't ok. | ||
* Use this function to override and set your own condition. | ||
* @param res http(s) Response object | ||
* @returns boolean | ||
*/ | ||
retryCondition?: (res: Response | nodefetch.Response) => boolean | Promise<boolean>; | ||
}; | ||
export declare function myFetch(input: RequestInfo | nodefetch.RequestInfo, init?: RequestInit | nodefetch.RequestInit, options?: myFetchOptions): Promise<Response>; |
@@ -31,3 +31,3 @@ "use strict"; | ||
var SET_MAX_CONCURRENT_REQUESTS = (max) => { | ||
MAX_CONCURRENT_REQUESTS = max; | ||
MAX_CONCURRENT_REQUESTS = Math.max(1, max); | ||
}; | ||
@@ -34,0 +34,0 @@ async function fetchWithConnection(input, init, options) { |
{ | ||
"name": "myfetchapi", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"description": "mFetch is a JavaScript library that provides a utility function for making HTTP requests with queuing and retry functionality.", | ||
@@ -5,0 +5,0 @@ "type": "commonjs", |
@@ -39,3 +39,3 @@ # myfetchapi | ||
- `input`: RequestInfo - The URL or Request object. | ||
- `init` (optional): RequestInit - The request options. | ||
- `init` (optional): RequestInit - The request [Options](https://www.npmjs.com/package/node-fetch#fetch-options) for the HTTP(S) request | ||
- `options` (optional): myFetchOptions - Additional options. | ||
@@ -53,2 +53,2 @@ - Returns: Promise<Response> | ||
This project is licensed under the ISC License | ||
This project is licensed under the MIT License |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
538176
13080
7