@microsoft/kiota-http-fetchlibrary
Version:
Kiota request adapter implementation with fetch
34 lines • 1.7 kB
TypeScript
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
import type { RequestOption } from "@microsoft/kiota-abstractions";
import type { Middleware } from "./middlewares/middleware.js";
export declare class HttpClient {
private readonly customFetch?;
private middleware;
/**
*
* Creates an instance of a HttpClient which contains the middlewares and fetch implementation for request execution.
* @param customFetch - custom fetch function - a Fetch API implementation
* @param middlewares - an array of Middleware handlers
*/
constructor(customFetch?: ((request: string, init: RequestInit) => Promise<Response>) | undefined, ...middlewares: Middleware[]);
/**
* Processes the middleware parameter passed to set this.middleware property
* The calling function should validate if middleware is not undefined or not empty.
* @param middleware - The middleware passed
*/
private setMiddleware;
/**
* Executes a request and returns a promise resolving the response.
* @param url the request url.
* @param requestInit the RequestInit object.
* @param requestOptions the request options.
* @returns the promise resolving the response.
*/
executeFetch(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption>): Promise<Response>;
}
//# sourceMappingURL=httpClient.d.ts.map