@@ -56,7 +56,7 @@ export function createApiKeyMiddleware({
56
56
} ;
57
57
}
58
58
59
- function getDefaultMiddleware ( ) : FetchMiddleware [ ] {
59
+ function createDefaultMiddleware ( ) : FetchMiddleware [ ] {
60
60
const setOriginMiddleware : FetchMiddleware = {
61
61
pre : context => {
62
62
// Send only the origin in the Referer header. For example, a document
@@ -67,9 +67,9 @@ function getDefaultMiddleware(): FetchMiddleware[] {
67
67
return [ setOriginMiddleware ] ;
68
68
}
69
69
70
- export function getDefaultFetchFn ( fetchLib : FetchFn , ...middleware : FetchMiddleware [ ] ) : FetchFn ;
71
- export function getDefaultFetchFn ( ...middleware : FetchMiddleware [ ] ) : FetchFn ;
72
- export function getDefaultFetchFn ( ...args : any [ ] ) : FetchFn {
70
+ export function createFetchFn ( fetchLib : FetchFn , ...middleware : FetchMiddleware [ ] ) : FetchFn ;
71
+ export function createFetchFn ( ...middleware : FetchMiddleware [ ] ) : FetchFn ;
72
+ export function createFetchFn ( ...args : any [ ] ) : FetchFn {
73
73
let fetchLib : FetchFn = fetch ;
74
74
let middlewareOpt : FetchMiddleware [ ] = [ ] ;
75
75
if ( args . length > 0 ) {
@@ -80,7 +80,7 @@ export function getDefaultFetchFn(...args: any[]): FetchFn {
80
80
if ( args . length > 0 ) {
81
81
middlewareOpt = args ;
82
82
}
83
- const middlewares = [ ...getDefaultMiddleware ( ) , ...middlewareOpt ] ;
83
+ const middlewares = [ ...createDefaultMiddleware ( ) , ...middlewareOpt ] ;
84
84
const fetchFn = async ( url : string , init ?: RequestInit | undefined ) : Promise < Response > => {
85
85
let fetchParams = { url, init : init ?? { } } ;
86
86
for ( const middleware of middlewares ) {
0 commit comments