@microsoft/kiota-http-fetchlibrary
Advanced tools
Comparing version 1.0.0-preview.72 to 1.0.0-preview.73
# Changelog | ||
## [1.0.0-preview.73](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-http-fetchlibrary@1.0.0-preview.72...@microsoft/kiota-http-fetchlibrary@1.0.0-preview.73) (2024-11-05) | ||
### Bug Fixes | ||
* fix Eslint configuration to parse all files. ([9a58d21](https://github.com/microsoft/kiota-typescript/commit/9a58d21e783830af6b54ae1d40e1cf6ee6dd5a1d)) | ||
### Dependencies | ||
* The following workspace dependencies were updated | ||
* dependencies | ||
* @microsoft/kiota-abstractions bumped from ^1.0.0-preview.72 to ^1.0.0-preview.73 | ||
## [1.0.0-preview.72](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-http-fetchlibrary@1.0.0-preview.71...@microsoft/kiota-http-fetchlibrary@1.0.0-preview.72) (2024-10-31) | ||
@@ -4,0 +18,0 @@ |
@@ -31,8 +31,8 @@ /** | ||
constructor(authenticationProvider: AuthenticationProvider, parseNodeFactory?: ParseNodeFactory, serializationWriterFactory?: SerializationWriterFactory, httpClient?: HttpClient, observabilityOptions?: ObservabilityOptions); | ||
private getResponseContentType; | ||
private getResponseHandler; | ||
private readonly getResponseContentType; | ||
private readonly getResponseHandler; | ||
private static readonly responseTypeAttributeKey; | ||
sendCollectionOfPrimitive: <ResponseType extends Exclude<PrimitiveTypesForDeserializationType, ArrayBuffer>>(requestInfo: RequestInformation, responseType: Exclude<PrimitiveTypesForDeserialization, "ArrayBuffer">, errorMappings: ErrorMappings | undefined) => Promise<ResponseType[] | undefined>; | ||
sendCollection: <ModelType extends Parsable>(requestInfo: RequestInformation, deserialization: ParsableFactory<ModelType>, errorMappings: ErrorMappings | undefined) => Promise<ModelType[] | undefined>; | ||
private startTracingSpan; | ||
private readonly startTracingSpan; | ||
static readonly eventResponseHandlerInvokedKey = "com.microsoft.kiota.response_handler_invoked"; | ||
@@ -44,17 +44,20 @@ send: <ModelType extends Parsable>(requestInfo: RequestInformation, deserializer: ParsableFactory<ModelType>, errorMappings: ErrorMappings | undefined) => Promise<ModelType | undefined>; | ||
sendCollectionOfEnum: <EnumObject extends Record<string, unknown>>(requestInfo: RequestInformation, enumObject: EnumObject, errorMappings: ErrorMappings | undefined) => Promise<EnumObject[keyof EnumObject][] | undefined>; | ||
enableBackingStore: (backingStoreFactory?: BackingStoreFactory | undefined) => void; | ||
private getRootParseNode; | ||
private shouldReturnUndefined; | ||
/** purges the response body if it hasn't been read to release the connection to the server */ | ||
private purgeResponseBody; | ||
enableBackingStore: (backingStoreFactory?: BackingStoreFactory) => void; | ||
private readonly getRootParseNode; | ||
private readonly shouldReturnUndefined; | ||
/** | ||
* purges the response body if it hasn't been read to release the connection to the server | ||
* @param response the response to purge | ||
*/ | ||
private readonly purgeResponseBody; | ||
static readonly errorMappingFoundAttributeName = "com.microsoft.kiota.error.mapping_found"; | ||
static readonly errorBodyFoundAttributeName = "com.microsoft.kiota.error.body_found"; | ||
private throwIfFailedResponse; | ||
private getHttpResponseMessage; | ||
private readonly throwIfFailedResponse; | ||
private readonly getHttpResponseMessage; | ||
static readonly authenticateChallengedEventKey = "com.microsoft.kiota.authenticate_challenge_received"; | ||
private retryCAEResponseIfRequired; | ||
private getClaimsFromResponse; | ||
private setBaseUrlForRequestInformation; | ||
private getRequestFromRequestInformation; | ||
private foldHeaderValue; | ||
private readonly retryCAEResponseIfRequired; | ||
private readonly getClaimsFromResponse; | ||
private readonly setBaseUrlForRequestInformation; | ||
private readonly getRequestFromRequestInformation; | ||
private readonly foldHeaderValue; | ||
/** | ||
@@ -61,0 +64,0 @@ * @inheritdoc |
@@ -228,3 +228,2 @@ /** | ||
case "ArrayBuffer": | ||
// eslint-disable-next-line no-case-declarations | ||
if (!response.body) { | ||
@@ -412,3 +411,6 @@ return undefined; | ||
}; | ||
/** purges the response body if it hasn't been read to release the connection to the server */ | ||
/** | ||
* purges the response body if it hasn't been read to release the connection to the server | ||
* @param response the response to purge | ||
*/ | ||
this.purgeResponseBody = async (response) => { | ||
@@ -445,3 +447,3 @@ if (!response.bodyUsed && response.body) { | ||
const rootNode = await this.getRootParseNode(response); | ||
let error = trace.getTracer(this.observabilityOptions.getTracerInstrumentationName()).startActiveSpan("getObjectValue", (deserializeSpan) => { | ||
let deserializedError = trace.getTracer(this.observabilityOptions.getTracerInstrumentationName()).startActiveSpan("getObjectValue", (deserializeSpan) => { | ||
try { | ||
@@ -454,6 +456,6 @@ return rootNode.getObjectValue(factory); | ||
}); | ||
spanForAttributes.setAttribute(FetchRequestAdapter.errorBodyFoundAttributeName, !!error); | ||
if (!error) | ||
error = new DefaultApiError("unexpected error type" + typeof error); | ||
const errorObject = error; | ||
spanForAttributes.setAttribute(FetchRequestAdapter.errorBodyFoundAttributeName, !!deserializedError); | ||
if (!deserializedError) | ||
deserializedError = new DefaultApiError("unexpected error type" + typeof deserializedError); | ||
const errorObject = deserializedError; | ||
errorObject.responseStatusCode = statusCode; | ||
@@ -478,3 +480,3 @@ errorObject.responseHeaders = responseHeaders; | ||
if (claims) { | ||
additionalContext["claims"] = claims; | ||
additionalContext.claims = claims; | ||
} | ||
@@ -542,5 +544,6 @@ await this.authenticationProvider.authenticateRequest(requestInfo, additionalContext); | ||
this.setBaseUrlForRequestInformation = (requestInfo) => { | ||
requestInfo.pathParameters["baseurl"] = this.baseUrl; | ||
requestInfo.pathParameters.baseurl = this.baseUrl; | ||
}; | ||
this.getRequestFromRequestInformation = (requestInfo, spanForAttributes) => { | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
return trace.getTracer(this.observabilityOptions.getTracerInstrumentationName()).startActiveSpan("getRequestFromRequestInformation", async (span) => { | ||
@@ -552,3 +555,3 @@ var _a, _b; | ||
spanForAttributes.setAttribute("http.request.method", method !== null && method !== void 0 ? method : ""); | ||
const uriContainsScheme = uri.indexOf("://") > -1; | ||
const uriContainsScheme = uri.includes("://"); | ||
const schemeSplatUri = uri.split("://"); | ||
@@ -555,0 +558,0 @@ if (uriContainsScheme) { |
@@ -10,22 +10,15 @@ /** | ||
export declare class HttpClient { | ||
private customFetch?; | ||
private readonly customFetch?; | ||
private middleware; | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* Creates an instance of a HttpClient which contains the middlewares and fetch implementation for request execution. | ||
* @param {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers | ||
* If middlewares param is undefined, the httpClient instance will use the default array of middlewares. | ||
* Set middlewares to `null` if you do not wish to use middlewares. | ||
* If custom fetch is undefined, the httpClient instance uses the `DefaultFetchHandler` | ||
* @param {(request: string, init?: RequestInit) => Promise < Response >} custom fetch function - a Fetch API implementation | ||
* | ||
* @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[]); | ||
/** | ||
* @private | ||
* 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} middleware - The middleware passed | ||
* @returns Nothing | ||
* @param middleware - The middleware passed | ||
*/ | ||
@@ -36,3 +29,4 @@ private setMiddleware; | ||
* @param url the request url. | ||
* @param options request options. | ||
* @param requestInit the RequestInit object. | ||
* @param requestOptions the request options. | ||
* @returns the promise resolving the response. | ||
@@ -39,0 +33,0 @@ */ |
@@ -11,11 +11,6 @@ /** | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* Creates an instance of a HttpClient which contains the middlewares and fetch implementation for request execution. | ||
* @param {...Middleware} middleware - The first middleware of the middleware chain or a sequence of all the Middleware handlers | ||
* If middlewares param is undefined, the httpClient instance will use the default array of middlewares. | ||
* Set middlewares to `null` if you do not wish to use middlewares. | ||
* If custom fetch is undefined, the httpClient instance uses the `DefaultFetchHandler` | ||
* @param {(request: string, init?: RequestInit) => Promise < Response >} custom fetch function - a Fetch API implementation | ||
* | ||
* @param customFetch - custom fetch function - a Fetch API implementation | ||
* @param middlewares - an array of Middleware handlers | ||
*/ | ||
@@ -28,2 +23,3 @@ constructor(customFetch, ...middlewares) { | ||
if (this.customFetch) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
middlewares.push(new CustomFetchHandler(customFetch)); | ||
@@ -35,7 +31,5 @@ } | ||
/** | ||
* @private | ||
* 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} middleware - The middleware passed | ||
* @returns Nothing | ||
* @param middleware - The middleware passed | ||
*/ | ||
@@ -51,3 +45,4 @@ setMiddleware(...middleware) { | ||
* @param url the request url. | ||
* @param options request options. | ||
* @param requestInit the RequestInit object. | ||
* @param requestOptions the request options. | ||
* @returns the promise resolving the response. | ||
@@ -54,0 +49,0 @@ */ |
@@ -10,3 +10,3 @@ /** | ||
/** | ||
* @class | ||
* | ||
* Class containing function(s) related to the middleware pipelines. | ||
@@ -16,8 +16,6 @@ */ | ||
/** | ||
* @public | ||
* @static | ||
* Returns an instance of HttpClient with the provided middlewares and custom fetch implementation both parameters are optional. | ||
* if not provided, the default fetch implementation and middlewares will be used. | ||
* @param {(request: string, init?: RequestInit) => Promise < Response >} customFetch - a Fetch API implementation | ||
* @param {Middleware[]} middlewares - an aray of Middleware handlers | ||
* @param customFetch - a Fetch API implementation | ||
* @param middlewares - an aray of Middleware handlers | ||
* If middlewares param is undefined, the httpClient instance will use the default array of middlewares. | ||
@@ -24,0 +22,0 @@ * Set middlewares to `null` if you do not wish to use middlewares. |
@@ -10,3 +10,3 @@ /** | ||
/** | ||
* @class | ||
* | ||
* Class containing function(s) related to the middleware pipelines. | ||
@@ -16,8 +16,6 @@ */ | ||
/** | ||
* @public | ||
* @static | ||
* Returns an instance of HttpClient with the provided middlewares and custom fetch implementation both parameters are optional. | ||
* if not provided, the default fetch implementation and middlewares will be used. | ||
* @param {(request: string, init?: RequestInit) => Promise < Response >} customFetch - a Fetch API implementation | ||
* @param {Middleware[]} middlewares - an aray of Middleware handlers | ||
* @param customFetch - a Fetch API implementation | ||
* @param middlewares - an aray of Middleware handlers | ||
* If middlewares param is undefined, the httpClient instance will use the default array of middlewares. | ||
@@ -48,2 +46,3 @@ * Set middlewares to `null` if you do not wish to use middlewares. | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
static create(customFetch = (...args) => fetch(...args), middlewares) { | ||
@@ -50,0 +49,0 @@ const middleware = middlewares || MiddlewareFactory.getDefaultMiddlewares(customFetch); |
@@ -9,3 +9,3 @@ /** | ||
/** | ||
* @class | ||
* | ||
* Class containing function(s) related to the middleware pipelines. | ||
@@ -15,4 +15,3 @@ */ | ||
/** | ||
* @public | ||
* @static | ||
* @param customFetch - The custom fetch implementation | ||
* Returns the default middleware chain an array with the middleware handlers | ||
@@ -19,0 +18,0 @@ * @returns an array of the middleware handlers of the default middleware chain |
@@ -14,3 +14,3 @@ /** | ||
/** | ||
* @class | ||
* | ||
* Class containing function(s) related to the middleware pipelines. | ||
@@ -20,7 +20,7 @@ */ | ||
/** | ||
* @public | ||
* @static | ||
* @param customFetch - The custom fetch implementation | ||
* Returns the default middleware chain an array with the middleware handlers | ||
* @returns an array of the middleware handlers of the default middleware chain | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
static getDefaultMiddlewares(customFetch = (...args) => fetch(...args)) { | ||
@@ -27,0 +27,0 @@ // Browsers handles redirection automatically and do not require the redirectionHandler |
@@ -14,5 +14,5 @@ /** | ||
/** | ||
* @class | ||
* | ||
* Class | ||
* @implements Middleware | ||
* Middleware | ||
* Class representing RedirectHandler | ||
@@ -23,4 +23,2 @@ */ | ||
* A member holding options to customize the handler behavior | ||
* | ||
* @private | ||
*/ | ||
@@ -30,13 +28,10 @@ options: ChaosHandlerOptions; | ||
* container for the manual map that has been written by the client | ||
* | ||
* @private | ||
*/ | ||
private manualMap; | ||
private readonly manualMap; | ||
/** @inheritdoc */ | ||
next: Middleware | undefined; | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of ChaosHandler | ||
* @param {ChaosHandlerOptions} [options = new ChaosHandlerOptions()] - The chaos handler options instance | ||
* @param [options] - The chaos handler options instance | ||
* @param manualMap - The Map passed by user containing url-statusCode info | ||
@@ -47,4 +42,3 @@ */ | ||
* Fetches a random status code for the RANDOM mode from the predefined array | ||
* @private | ||
* @param {string} requestMethod - the API method for the request | ||
* @param requestMethod - the API method for the request | ||
* @returns a random status code from a given set of status codes | ||
@@ -55,5 +49,4 @@ */ | ||
* Strips out the host url and returns the relative url only | ||
* @private | ||
* @param {ChaosHandlerOptions} chaosHandlerOptions - The ChaosHandlerOptions object | ||
* @param {string} urlMethod - the complete URL | ||
* @param chaosHandlerOptions - The ChaosHandlerOptions object | ||
* @param urlMethod - the complete URL | ||
* @returns the string as relative URL | ||
@@ -64,6 +57,6 @@ */ | ||
* Gets a status code from the options or a randomly generated status code | ||
* @param {ChaosHandlerOptions} chaosHandlerOptions - The ChaosHandlerOptions object | ||
* @param {string} requestURL - the URL for the request | ||
* @param {HttpMethod} requestMethod - the API method for the request | ||
* @returns {number} generated statusCode | ||
* @param chaosHandlerOptions - The ChaosHandlerOptions object | ||
* @param requestURL - the URL for the request | ||
* @param requestMethod - the API method for the request | ||
* @returns generated statusCode | ||
*/ | ||
@@ -73,7 +66,5 @@ private getStatusCode; | ||
* Generates a respondy for the chaoe response | ||
* @private | ||
* @param {ChaosHandlerOptions} chaosHandlerOptions - The ChaosHandlerOptions object | ||
* @param {string} requestID - request id | ||
* @param {string} requestDate - date of the request | ||
* * @returns response body | ||
* @param chaosHandlerOptions - The ChaosHandlerOptions object | ||
* @param statusCode - the status code for the response | ||
* @returns the response body | ||
*/ | ||
@@ -83,8 +74,8 @@ private createResponseBody; | ||
* Composes a new chaotic response code with the configured parameters | ||
* @param {string} url | ||
* @param {FetchRequestInit} fetchRequestInit | ||
* @returns {Response} | ||
* @param url The url of the request | ||
* @param fetchRequestInit The fetch request init object | ||
* @returns a response object with the configured parameters | ||
*/ | ||
private createChaosResponse; | ||
execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption> | undefined): Promise<Response>; | ||
execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption>): Promise<Response>; | ||
static readonly chaosHandlerTriggeredEventKey = "com.microsoft.kiota.chaos_handler_triggered"; | ||
@@ -91,0 +82,0 @@ private runChaos; |
@@ -12,5 +12,5 @@ /** | ||
/** | ||
* @class | ||
* | ||
* Class | ||
* @implements Middleware | ||
* Middleware | ||
* Class representing RedirectHandler | ||
@@ -20,6 +20,5 @@ */ | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of ChaosHandler | ||
* @param {ChaosHandlerOptions} [options = new ChaosHandlerOptions()] - The chaos handler options instance | ||
* @param [options] - The chaos handler options instance | ||
* @param manualMap - The Map passed by user containing url-statusCode info | ||
@@ -30,4 +29,2 @@ */ | ||
* A member holding options to customize the handler behavior | ||
* | ||
* @private | ||
*/ | ||
@@ -44,2 +41,3 @@ this.options = { | ||
this.options = chaosOptions; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
this.manualMap = manualMap !== null && manualMap !== void 0 ? manualMap : new Map(); | ||
@@ -49,4 +47,3 @@ } | ||
* Fetches a random status code for the RANDOM mode from the predefined array | ||
* @private | ||
* @param {string} requestMethod - the API method for the request | ||
* @param requestMethod - the API method for the request | ||
* @returns a random status code from a given set of status codes | ||
@@ -60,5 +57,4 @@ */ | ||
* Strips out the host url and returns the relative url only | ||
* @private | ||
* @param {ChaosHandlerOptions} chaosHandlerOptions - The ChaosHandlerOptions object | ||
* @param {string} urlMethod - the complete URL | ||
* @param chaosHandlerOptions - The ChaosHandlerOptions object | ||
* @param urlMethod - the complete URL | ||
* @returns the string as relative URL | ||
@@ -75,6 +71,6 @@ */ | ||
* Gets a status code from the options or a randomly generated status code | ||
* @param {ChaosHandlerOptions} chaosHandlerOptions - The ChaosHandlerOptions object | ||
* @param {string} requestURL - the URL for the request | ||
* @param {HttpMethod} requestMethod - the API method for the request | ||
* @returns {number} generated statusCode | ||
* @param chaosHandlerOptions - The ChaosHandlerOptions object | ||
* @param requestURL - the URL for the request | ||
* @param requestMethod - the API method for the request | ||
* @returns generated statusCode | ||
*/ | ||
@@ -118,10 +114,9 @@ getStatusCode(chaosHandlerOptions, requestURL, requestMethod) { | ||
* Generates a respondy for the chaoe response | ||
* @private | ||
* @param {ChaosHandlerOptions} chaosHandlerOptions - The ChaosHandlerOptions object | ||
* @param {string} requestID - request id | ||
* @param {string} requestDate - date of the request | ||
* * @returns response body | ||
* @param chaosHandlerOptions - The ChaosHandlerOptions object | ||
* @param statusCode - the status code for the response | ||
* @returns the response body | ||
*/ | ||
createResponseBody(chaosHandlerOptions, statusCode) { | ||
if (chaosHandlerOptions.responseBody) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return chaosHandlerOptions.responseBody; | ||
@@ -143,2 +138,3 @@ } | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return body; | ||
@@ -148,5 +144,5 @@ } | ||
* Composes a new chaotic response code with the configured parameters | ||
* @param {string} url | ||
* @param {FetchRequestInit} fetchRequestInit | ||
* @returns {Response} | ||
* @param url The url of the request | ||
* @param fetchRequestInit The fetch request init object | ||
* @returns a response object with the configured parameters | ||
*/ | ||
@@ -160,2 +156,3 @@ createChaosResponse(url, fetchRequestInit) { | ||
const statusCode = this.getStatusCode(this.options, url, requestMethod); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const responseBody = this.createResponseBody(this.options, statusCode); | ||
@@ -162,0 +159,0 @@ const stringBody = typeof responseBody === "string" ? responseBody : JSON.stringify(responseBody); |
@@ -17,4 +17,2 @@ /** | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the name of content range header | ||
@@ -24,4 +22,2 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the name of content encoding header | ||
@@ -31,6 +27,4 @@ */ | ||
/** | ||
* @public | ||
* @constructor | ||
* Creates a new instance of the CompressionHandler class | ||
* @param {CompressionHandlerOptions} handlerOptions The options for the compression handler. | ||
* @param handlerOptions The options for the compression handler. | ||
* @returns An instance of the CompressionHandler class | ||
@@ -42,3 +36,3 @@ */ | ||
*/ | ||
execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption> | undefined): Promise<Response>; | ||
execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption>): Promise<Response>; | ||
private executeInternal; | ||
@@ -45,0 +39,0 @@ private contentRangeBytesIsPresent; |
@@ -17,6 +17,4 @@ /** | ||
/** | ||
* @public | ||
* @constructor | ||
* Creates a new instance of the CompressionHandler class | ||
* @param {CompressionHandlerOptions} handlerOptions The options for the compression handler. | ||
* @param handlerOptions The options for the compression handler. | ||
* @returns An instance of the CompressionHandler class | ||
@@ -162,2 +160,3 @@ */ | ||
async compressUsingZlib(body) { | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
@@ -202,4 +201,2 @@ const zlib = await import("zlib"); | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the name of content range header | ||
@@ -209,4 +206,2 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the name of content encoding header | ||
@@ -213,0 +208,0 @@ */ |
@@ -12,4 +12,3 @@ /** | ||
/** | ||
* @class | ||
* @implements Middleware | ||
* Middleware | ||
* Class for FetchHandler | ||
@@ -20,3 +19,3 @@ */ | ||
/** | ||
* @private | ||
* | ||
* The next middleware in the middleware chain | ||
@@ -23,0 +22,0 @@ */ |
@@ -8,4 +8,3 @@ /** | ||
/** | ||
* @class | ||
* @implements Middleware | ||
* Middleware | ||
* Class for FetchHandler | ||
@@ -12,0 +11,0 @@ */ |
@@ -11,4 +11,3 @@ /** | ||
/** | ||
* @class | ||
* @implements Middleware | ||
* Middleware | ||
* Inspects the headers of the request and response | ||
@@ -19,16 +18,15 @@ */ | ||
/** | ||
* @constructor | ||
* @public | ||
* | ||
* Creates new instance of HeadersInspectionHandler | ||
* @param {HeadersInspectionOptions} _options The options for inspecting the headers | ||
* @param _options The options for inspecting the headers | ||
*/ | ||
constructor(_options?: HeadersInspectionOptions); | ||
/** | ||
* @private | ||
* | ||
* The next middleware in the middleware chain | ||
*/ | ||
next: Middleware | undefined; | ||
execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption> | undefined): Promise<Response>; | ||
execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption>): Promise<Response>; | ||
private executeInternal; | ||
} | ||
//# sourceMappingURL=headersInspectionHandler.d.ts.map |
@@ -11,4 +11,3 @@ /** | ||
/** | ||
* @class | ||
* @implements Middleware | ||
* Middleware | ||
* Inspects the headers of the request and response | ||
@@ -18,6 +17,5 @@ */ | ||
/** | ||
* @constructor | ||
* @public | ||
* | ||
* Creates new instance of HeadersInspectionHandler | ||
* @param {HeadersInspectionOptions} _options The options for inspecting the headers | ||
* @param _options The options for inspecting the headers | ||
*/ | ||
@@ -24,0 +22,0 @@ constructor(_options = new HeadersInspectionOptions()) { |
@@ -13,8 +13,7 @@ /** | ||
/** | ||
* @public | ||
* @async | ||
* Main method of the middleware. | ||
* @param url The url for the request | ||
* @param requestInit The Fetch RequestInit object. | ||
* @param url The URL of the request. | ||
* @return A promise that resolves to the response object. | ||
* @param requestOptions The request options. | ||
* @returns A promise that resolves to the response object. | ||
*/ | ||
@@ -21,0 +20,0 @@ execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption>): Promise<Response>; |
@@ -9,3 +9,3 @@ /** | ||
/** | ||
* @class | ||
* | ||
* Class containing function(s) related to the middleware pipelines. | ||
@@ -15,4 +15,3 @@ */ | ||
/** | ||
* @public | ||
* @static | ||
* @param customFetch - The custom fetch implementation | ||
* Returns the default middleware chain an array with the middleware handlers | ||
@@ -19,0 +18,0 @@ * @returns an array of the middleware handlers of the default middleware chain |
@@ -15,3 +15,3 @@ /** | ||
/** | ||
* @class | ||
* | ||
* Class containing function(s) related to the middleware pipelines. | ||
@@ -21,7 +21,7 @@ */ | ||
/** | ||
* @public | ||
* @static | ||
* @param customFetch - The custom fetch implementation | ||
* Returns the default middleware chain an array with the middleware handlers | ||
* @returns an array of the middleware handlers of the default middleware chain | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
static getDefaultMiddlewares(customFetch = (...args) => fetch(...args)) { | ||
@@ -28,0 +28,0 @@ return [new RetryHandler(), new RedirectHandler(), new ParametersNameDecodingHandler(), new UserAgentHandler(), new CompressionHandler(), new HeadersInspectionHandler(), new CustomFetchHandler(customFetch)]; |
@@ -10,11 +10,7 @@ /** | ||
*/ | ||
export declare const methodStatusCode: { | ||
[key: string]: number[]; | ||
}; | ||
export declare const methodStatusCode: Record<string, number[]>; | ||
/** | ||
* Contains statusCode to statusMessage map | ||
*/ | ||
export declare const httpStatusCode: { | ||
[key: number]: string; | ||
}; | ||
export declare const httpStatusCode: Record<number, string>; | ||
//# sourceMappingURL=ChaosHandlerData.d.ts.map |
@@ -15,5 +15,2 @@ /** | ||
* interface representing ChaosHandlerOptions | ||
* @interface | ||
* interface | ||
* @implements MiddlewareOptions | ||
*/ | ||
@@ -23,4 +20,2 @@ export interface ChaosHandlerOptions { | ||
* Speficies the base url path for the destination server, used when relative paths are preffered to strip out paths | ||
* | ||
* @public | ||
*/ | ||
@@ -30,4 +25,2 @@ baseUrl?: string; | ||
* Specifies the startegy used for the Testing Handler -> RANDOM/MANUAL | ||
* | ||
* @public | ||
*/ | ||
@@ -37,4 +30,2 @@ chaosStrategy: ChaosStrategy; | ||
* Status code to be returned in the response | ||
* | ||
* @public | ||
*/ | ||
@@ -44,4 +35,2 @@ statusCode?: number; | ||
* The Message to be returned in the response | ||
* | ||
* @public | ||
*/ | ||
@@ -53,3 +42,2 @@ statusMessage: string; | ||
* Setting the default value as 10% | ||
* @public | ||
*/ | ||
@@ -59,4 +47,2 @@ chaosPercentage: number; | ||
* The response body to be returned in the response | ||
* | ||
* @public | ||
*/ | ||
@@ -66,4 +52,2 @@ responseBody?: any; | ||
* The response headers to be returned in the response | ||
* | ||
* @public | ||
*/ | ||
@@ -70,0 +54,0 @@ headers?: FetchHeaders; |
@@ -12,3 +12,2 @@ /** | ||
* Strategy used for Testing Handler | ||
* @enum | ||
*/ | ||
@@ -15,0 +14,0 @@ export declare enum ChaosStrategy { |
@@ -12,3 +12,2 @@ /** | ||
* Strategy used for Testing Handler | ||
* @enum | ||
*/ | ||
@@ -15,0 +14,0 @@ export var ChaosStrategy; |
@@ -10,10 +10,6 @@ /** | ||
/** | ||
* @interface | ||
* Signature to define the HeadersInspectionOptions constructor parameters | ||
* @property {boolean} [inspectRequestHeaders = false] - Whether to inspect request headers | ||
* @property {boolean} [inspectResponseHeaders = false] - Whether to inspect response headers | ||
*/ | ||
export interface HeadersInspectionOptionsParams { | ||
/** | ||
* @member | ||
* whether to inspect request headers | ||
@@ -23,3 +19,2 @@ */ | ||
/** | ||
* @member | ||
* whether to inspect response headers | ||
@@ -30,4 +25,3 @@ */ | ||
/** | ||
* @class | ||
* @implements RequestOption | ||
* RequestOption | ||
* Options | ||
@@ -40,4 +34,2 @@ * Options to inspect headers | ||
/** | ||
* @public | ||
* @getter | ||
* Gets the request headers | ||
@@ -48,4 +40,2 @@ * @returns the request headers | ||
/** | ||
* @public | ||
* @getter | ||
* Gets the response headers | ||
@@ -56,4 +46,2 @@ * @returns the response headers | ||
/** | ||
* @public | ||
* @member | ||
* @default false | ||
@@ -64,4 +52,2 @@ * whether to inspect request headers | ||
/** | ||
* @public | ||
* @member | ||
* @default false | ||
@@ -72,6 +58,5 @@ * whether to inspect response headers | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of HeadersInspectionOptions | ||
* @param {HeadersInspectionOptionsParams} [options = {}] - The headers inspection options value | ||
* @param [options] - The headers inspection options value | ||
* @returns An instance of HeadersInspectionOptions | ||
@@ -78,0 +63,0 @@ * @example const options = new HeadersInspectionOptions({ inspectRequestHeaders: true, inspectResponseHeaders: true }); |
@@ -10,4 +10,3 @@ /** | ||
/** | ||
* @class | ||
* @implements RequestOption | ||
* RequestOption | ||
* Options | ||
@@ -18,4 +17,2 @@ * Options to inspect headers | ||
/** | ||
* @public | ||
* @getter | ||
* Gets the request headers | ||
@@ -28,4 +25,2 @@ * @returns the request headers | ||
/** | ||
* @public | ||
* @getter | ||
* Gets the response headers | ||
@@ -38,6 +33,5 @@ * @returns the response headers | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of HeadersInspectionOptions | ||
* @param {HeadersInspectionOptionsParams} [options = {}] - The headers inspection options value | ||
* @param [options] - The headers inspection options value | ||
* @returns An instance of HeadersInspectionOptions | ||
@@ -44,0 +38,0 @@ * @example const options = new HeadersInspectionOptions({ inspectRequestHeaders: true, inspectResponseHeaders: true }); |
@@ -13,3 +13,2 @@ /** | ||
/** | ||
* @interface | ||
* Signature to define the ParametersNameDecodingHandlerOptions constructor parameters | ||
@@ -19,9 +18,7 @@ */ | ||
/** | ||
* @member | ||
* Whether to decode the specified characters in the request query parameters names | ||
* * @default true | ||
* @default true | ||
*/ | ||
enable?: boolean; | ||
/** | ||
* @member | ||
* The characters to decode | ||
@@ -35,3 +32,3 @@ * @default [".", "-", "~", "$"] | ||
/** | ||
* @public | ||
* | ||
* Whether to decode the specified characters in the request query parameters names | ||
@@ -41,3 +38,3 @@ */ | ||
/** | ||
* @public | ||
* | ||
* The characters to decode | ||
@@ -49,6 +46,5 @@ * @default [".", "-", "~", "$"] | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of ParametersNameDecodingHandlerOptions | ||
* @param {ParametersNameDecodingHandlerOptionsParams} [options = {}] - The optional parameters | ||
* @param [options] - The optional parameters | ||
* @returns An instance of ParametersNameDecodingHandlerOptions | ||
@@ -55,0 +51,0 @@ * @example ParametersNameDecodingHandlerOptions({ enable: true, charactersToDecode: [".", "-", "~", "$"] }); |
@@ -14,6 +14,5 @@ /** | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of ParametersNameDecodingHandlerOptions | ||
* @param {ParametersNameDecodingHandlerOptionsParams} [options = {}] - The optional parameters | ||
* @param [options] - The optional parameters | ||
* @returns An instance of ParametersNameDecodingHandlerOptions | ||
@@ -20,0 +19,0 @@ * @example ParametersNameDecodingHandlerOptions({ enable: true, charactersToDecode: [".", "-", "~", "$"] }); |
@@ -12,3 +12,3 @@ /** | ||
/** | ||
* @type | ||
* | ||
* A type declaration for shouldRetry callback | ||
@@ -23,4 +23,3 @@ */ | ||
/** | ||
* @class | ||
* @implements MiddlewareOptions | ||
* MiddlewareOptions | ||
* A class representing RedirectHandlerOptions | ||
@@ -30,20 +29,17 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member holding default max redirects value | ||
*/ | ||
private static DEFAULT_MAX_REDIRECTS; | ||
private static readonly DEFAULT_MAX_REDIRECTS; | ||
/** | ||
* @private | ||
* @static | ||
* A member holding maximum max redirects value | ||
*/ | ||
private static MAX_MAX_REDIRECTS; | ||
private static readonly MAX_MAX_REDIRECTS; | ||
/** | ||
* @private | ||
* | ||
* A member holding default shouldRedirect callback | ||
* @returns true | ||
*/ | ||
private static defaultShouldRetry; | ||
private static readonly defaultShouldRetry; | ||
/** | ||
* @public | ||
* | ||
* A member holding the max redirects value | ||
@@ -53,3 +49,3 @@ */ | ||
/** | ||
* @public | ||
* | ||
* A member holding the should redirect callback | ||
@@ -59,6 +55,5 @@ */ | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of RedirectHandlerOptions | ||
* @param {RedirectHandlerOptionsParams} [options = {}] - The redirect handler options instance | ||
* @param [options] - The redirect handler options instance | ||
* @returns An instance of RedirectHandlerOptions | ||
@@ -65,0 +60,0 @@ * @throws Error if maxRedirects is more than 20 or less than 0 |
@@ -9,4 +9,3 @@ /** | ||
/** | ||
* @class | ||
* @implements MiddlewareOptions | ||
* MiddlewareOptions | ||
* A class representing RedirectHandlerOptions | ||
@@ -16,6 +15,5 @@ */ | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of RedirectHandlerOptions | ||
* @param {RedirectHandlerOptionsParams} [options = {}] - The redirect handler options instance | ||
* @param [options] - The redirect handler options instance | ||
* @returns An instance of RedirectHandlerOptions | ||
@@ -45,4 +43,2 @@ * @throws Error if maxRedirects is more than 20 or less than 0 | ||
/** | ||
* @private | ||
* @static | ||
* A member holding default max redirects value | ||
@@ -52,4 +48,2 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member holding maximum max redirects value | ||
@@ -59,6 +53,7 @@ */ | ||
/** | ||
* @private | ||
* | ||
* A member holding default shouldRedirect callback | ||
* @returns true | ||
*/ | ||
RedirectHandlerOptions.defaultShouldRetry = () => true; | ||
//# sourceMappingURL=redirectHandlerOptions.js.map |
@@ -13,3 +13,3 @@ /** | ||
/** | ||
* @type | ||
* | ||
* A type declaration for shouldRetry callback | ||
@@ -20,3 +20,2 @@ */ | ||
/** | ||
* @interface | ||
* Signature to define the RetryHandlerOptions constructor parameters | ||
@@ -26,3 +25,2 @@ */ | ||
/** | ||
* @member | ||
* The delay value in seconds | ||
@@ -33,3 +31,2 @@ * @default 3 | ||
/** | ||
* @member | ||
* The maxRetries value | ||
@@ -40,3 +37,2 @@ * @default 3 | ||
/** | ||
* @member | ||
* The shouldRetry callback function | ||
@@ -47,4 +43,3 @@ */ | ||
/** | ||
* @class | ||
* @implements RequestOption | ||
* RequestOption | ||
* Options | ||
@@ -55,33 +50,25 @@ * Class for RetryHandlerOptions | ||
/** | ||
* @private | ||
* @static | ||
* A member holding default delay value in seconds | ||
*/ | ||
private static DEFAULT_DELAY; | ||
private static readonly DEFAULT_DELAY; | ||
/** | ||
* @private | ||
* @static | ||
* A member holding default maxRetries value | ||
*/ | ||
private static DEFAULT_MAX_RETRIES; | ||
private static readonly DEFAULT_MAX_RETRIES; | ||
/** | ||
* @private | ||
* @static | ||
* A member holding maximum delay value in seconds | ||
*/ | ||
private static MAX_DELAY; | ||
private static readonly MAX_DELAY; | ||
/** | ||
* @private | ||
* @static | ||
* A member holding maximum maxRetries value | ||
*/ | ||
private static MAX_MAX_RETRIES; | ||
private static readonly MAX_MAX_RETRIES; | ||
/** | ||
* @private | ||
* A member holding default shouldRetry callback | ||
* @returns true | ||
*/ | ||
private static defaultShouldRetry; | ||
private static readonly defaultShouldRetry; | ||
delay: number; | ||
/** | ||
* @public | ||
* | ||
* A member holding maxRetries value | ||
@@ -91,3 +78,3 @@ */ | ||
/** | ||
* @public | ||
* | ||
* A member holding shouldRetry callback | ||
@@ -97,6 +84,5 @@ */ | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of RetryHandlerOptions | ||
* @param {RetryHandlerOptionsParams} options - The RetryHandlerOptionsParams object | ||
* @param options - The RetryHandlerOptionsParams object | ||
* @returns An instance of RetryHandlerOptions | ||
@@ -107,6 +93,6 @@ * @example const options = new RetryHandlerOptions({ maxRetries: 4 }); | ||
/** | ||
* @private | ||
* | ||
* Creates an error object with a message and name | ||
* @param {string} message - The error message | ||
* @param {string} name - The error name | ||
* @param message - The error message | ||
* @param name - The error name | ||
* @returns An error object | ||
@@ -116,3 +102,3 @@ */ | ||
/** | ||
* @public | ||
* | ||
* To get the maximum delay | ||
@@ -119,0 +105,0 @@ * @returns A maximum delay |
@@ -9,4 +9,3 @@ /** | ||
/** | ||
* @class | ||
* @implements RequestOption | ||
* RequestOption | ||
* Options | ||
@@ -17,6 +16,5 @@ * Class for RetryHandlerOptions | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of RetryHandlerOptions | ||
* @param {RetryHandlerOptionsParams} options - The RetryHandlerOptionsParams object | ||
* @param options - The RetryHandlerOptionsParams object | ||
* @returns An instance of RetryHandlerOptions | ||
@@ -44,6 +42,6 @@ * @example const options = new RetryHandlerOptions({ maxRetries: 4 }); | ||
/** | ||
* @private | ||
* | ||
* Creates an error object with a message and name | ||
* @param {string} message - The error message | ||
* @param {string} name - The error name | ||
* @param message - The error message | ||
* @param name - The error name | ||
* @returns An error object | ||
@@ -57,3 +55,3 @@ */ | ||
/** | ||
* @public | ||
* | ||
* To get the maximum delay | ||
@@ -70,4 +68,2 @@ * @returns A maximum delay | ||
/** | ||
* @private | ||
* @static | ||
* A member holding default delay value in seconds | ||
@@ -77,4 +73,2 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member holding default maxRetries value | ||
@@ -84,4 +78,2 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member holding maximum delay value in seconds | ||
@@ -91,4 +83,2 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member holding maximum maxRetries value | ||
@@ -98,6 +88,6 @@ */ | ||
/** | ||
* @private | ||
* A member holding default shouldRetry callback | ||
* @returns true | ||
*/ | ||
RetryHandlerOptions.defaultShouldRetry = () => true; | ||
//# sourceMappingURL=retryHandlerOptions.js.map |
@@ -10,7 +10,2 @@ /** | ||
/** | ||
* @interface | ||
* Signature to define the user agent handler options | ||
* @property {boolean} [enable = true] - Whether to add the user agent header to the request | ||
* @property {string} [productName = "kiota-typescript"] - The product name to be added to the user agent header | ||
* @property {string} [productVersion = "1.0.0-preview.12"] - The product version to be added to the user agent header | ||
* | ||
@@ -21,3 +16,2 @@ * Represents the options for the UserAgentHandler. | ||
/** | ||
* @member | ||
* @default true | ||
@@ -28,3 +22,2 @@ * Specifies whether to add the user agent header to the request | ||
/** | ||
* @member | ||
* @default "kiota-typescript" | ||
@@ -35,3 +28,2 @@ * The product name to be added to the user agent header | ||
/** | ||
* @member | ||
* @default "1.0.0-preview.12" | ||
@@ -47,3 +39,2 @@ * The product version to be added to the user agent header | ||
/** | ||
* @member | ||
* Specifies whether to add the user agent header to the request | ||
@@ -53,3 +44,2 @@ */ | ||
/** | ||
* @member | ||
* @default "kiota-typescript" | ||
@@ -60,3 +50,2 @@ * The product name to be added to the user agent header | ||
/** | ||
* @member | ||
* The product version to be added to the user agent header | ||
@@ -67,6 +56,5 @@ */ | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of UserAgentHandlerOptions | ||
* @param {UserAgentHandlerOptionsParams} [options = {}] - The options for the UserAgentHandler | ||
* @param [options] - The options for the UserAgentHandler | ||
* @example const options = new UserAgentHandlerOptions({ enable: false }); | ||
@@ -73,0 +61,0 @@ */ |
@@ -17,6 +17,5 @@ /** | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of UserAgentHandlerOptions | ||
* @param {UserAgentHandlerOptionsParams} [options = {}] - The options for the UserAgentHandler | ||
* @param [options] - The options for the UserAgentHandler | ||
* @example const options = new UserAgentHandlerOptions({ enable: false }); | ||
@@ -23,0 +22,0 @@ */ |
@@ -0,2 +1,8 @@ | ||
/** | ||
* ------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. | ||
* See License in the project root for license information. | ||
* ------------------------------------------------------------------------------------------- | ||
*/ | ||
export declare const libraryVersion = "1.0.0-preview.24"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -0,1 +1,7 @@ | ||
/** | ||
* ------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. | ||
* See License in the project root for license information. | ||
* ------------------------------------------------------------------------------------------- | ||
*/ | ||
// x-release-please-start-version | ||
@@ -2,0 +8,0 @@ export const libraryVersion = "1.0.0-preview.24"; |
@@ -16,6 +16,5 @@ /** | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of ParametersNameDecodingHandler | ||
* @param {ParametersNameDecodingHandlerOptions} [options = new ParametersNameDecodingHandlerOptions()] - The parameters name decoding handler options value | ||
* @param [options] - The parameters name decoding handler options value | ||
*/ | ||
@@ -26,8 +25,6 @@ constructor(options?: ParametersNameDecodingHandlerOptions); | ||
/** | ||
* @public | ||
* @async | ||
* To execute the current middleware | ||
* @param {string} url - The url to be fetched | ||
* @param {FetchRequestInit} requestInit - The request init object | ||
* @param {Record<string, RequestOption>} [requestOptions] - The request options | ||
* @param url - The url to be fetched | ||
* @param requestInit - The request init object | ||
* @param requestOptions - The request options | ||
* @returns A Promise that resolves to nothing | ||
@@ -34,0 +31,0 @@ */ |
@@ -15,6 +15,5 @@ /** | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of ParametersNameDecodingHandler | ||
* @param {ParametersNameDecodingHandlerOptions} [options = new ParametersNameDecodingHandlerOptions()] - The parameters name decoding handler options value | ||
* @param [options] - The parameters name decoding handler options value | ||
*/ | ||
@@ -28,8 +27,6 @@ constructor(options = new ParametersNameDecodingHandlerOptions()) { | ||
/** | ||
* @public | ||
* @async | ||
* To execute the current middleware | ||
* @param {string} url - The url to be fetched | ||
* @param {FetchRequestInit} requestInit - The request init object | ||
* @param {Record<string, RequestOption>} [requestOptions] - The request options | ||
* @param url - The url to be fetched | ||
* @param requestInit - The request init object | ||
* @param requestOptions - The request options | ||
* @returns A Promise that resolves to nothing | ||
@@ -39,3 +36,3 @@ */ | ||
let currentOptions = this.options; | ||
if (requestOptions && requestOptions[ParametersNameDecodingHandlerOptionsKey]) { | ||
if (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions[ParametersNameDecodingHandlerOptionsKey]) { | ||
currentOptions = requestOptions[ParametersNameDecodingHandlerOptionsKey]; | ||
@@ -60,3 +57,3 @@ } | ||
let updatedUrl = url; | ||
if (currentOptions && currentOptions.enable && url.indexOf("%") > -1 && currentOptions.charactersToDecode && currentOptions.charactersToDecode.length > 0) { | ||
if (currentOptions && currentOptions.enable && url.includes("%") && currentOptions.charactersToDecode && currentOptions.charactersToDecode.length > 0) { | ||
currentOptions.charactersToDecode.forEach((character) => { | ||
@@ -63,0 +60,0 @@ updatedUrl = updatedUrl.replace(new RegExp(`%${character.charCodeAt(0).toString(16)}`, "gi"), character); |
@@ -14,39 +14,29 @@ /** | ||
/** | ||
* @class | ||
* | ||
* Class | ||
* @implements Middleware | ||
* Middleware | ||
* Class representing RedirectHandler | ||
*/ | ||
export declare class RedirectHandler implements Middleware { | ||
private options; | ||
private readonly options; | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the array of redirect status codes | ||
*/ | ||
private static REDIRECT_STATUS_CODES; | ||
private static readonly REDIRECT_STATUS_CODES; | ||
/** | ||
* @private | ||
* @static | ||
* A member holding SeeOther status code | ||
*/ | ||
private static STATUS_CODE_SEE_OTHER; | ||
private static readonly STATUS_CODE_SEE_OTHER; | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the name of the location header | ||
*/ | ||
private static LOCATION_HEADER; | ||
private static readonly LOCATION_HEADER; | ||
/** | ||
* @private | ||
* @static | ||
* A member representing the authorization header name | ||
*/ | ||
private static AUTHORIZATION_HEADER; | ||
private static readonly AUTHORIZATION_HEADER; | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the manual redirect value | ||
*/ | ||
private static MANUAL_REDIRECT; | ||
private static readonly MANUAL_REDIRECT; | ||
/** Next middleware to be executed*/ | ||
@@ -56,6 +46,5 @@ next: Middleware | undefined; | ||
* | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of RedirectHandler | ||
* @param {RedirectHandlerOptions} [options = new RedirectHandlerOptions()] - The redirect handler options instance | ||
* @param [options] - The redirect handler options instance | ||
* @returns An instance of RedirectHandler | ||
@@ -65,5 +54,5 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To check whether the response has the redirect status code or not | ||
* @param {Response} response - The response object | ||
* @param response - The response object | ||
* @returns A boolean representing whether the response contains the redirect status code or not | ||
@@ -73,5 +62,5 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To check whether the response has location header or not | ||
* @param {Response} response - The response object | ||
* @param response - The response object | ||
* @returns A boolean representing the whether the response has location header or not | ||
@@ -81,5 +70,5 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To get the redirect url from location header in response object | ||
* @param {Response} response - The response object | ||
* @param response - The response object | ||
* @returns A redirect url from location header | ||
@@ -89,5 +78,5 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To check whether the given url is a relative url or not | ||
* @param {string} url - The url string value | ||
* @param url - The url string value | ||
* @returns A boolean representing whether the given url is a relative url or not | ||
@@ -97,6 +86,6 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To check whether the authorization header in the request should be dropped for consequent redirected requests | ||
* @param {string} requestUrl - The request url value | ||
* @param {string} redirectUrl - The redirect url value | ||
* @param requestUrl - The request url value | ||
* @param redirectUrl - The redirect url value | ||
* @returns A boolean representing whether the authorization header in the request should be dropped for consequent redirected requests | ||
@@ -106,10 +95,9 @@ */ | ||
/** | ||
* @private | ||
* @async | ||
* To execute the next middleware and to handle in case of redirect response returned by the server | ||
* @param {Context} context - The context object | ||
* @param {number} redirectCount - The redirect count value | ||
* @param {Record<string, RequestOption>} [requestOptions = {}] - The request options | ||
* @param {RedirectHandlerOptions} currentOptions - The redirect handler options instance | ||
* @param {string} tracerName - The name to use for the tracer | ||
* @param url - The url string value | ||
* @param fetchRequestInit - The Fetch RequestInit object | ||
* @param redirectCount - The redirect count value | ||
* @param currentOptions - The redirect handler options instance | ||
* @param requestOptions - The request options | ||
* @param tracerName - The name to use for the tracer | ||
* @returns A promise that resolves to nothing | ||
@@ -119,7 +107,7 @@ */ | ||
/** | ||
* @public | ||
* @async | ||
* To execute the current middleware | ||
* @param {Context} context - The context object of the request | ||
* @returns A Promise that resolves to nothing | ||
* Executes the request and returns a promise resolving the response. | ||
* @param url - The url for the request | ||
* @param requestInit - The Fetch RequestInit object. | ||
* @param requestOptions - The request options. | ||
* @returns A Promise that resolves to the response. | ||
*/ | ||
@@ -126,0 +114,0 @@ execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption>): Promise<Response>; |
@@ -15,5 +15,5 @@ /** | ||
/** | ||
* @class | ||
* | ||
* Class | ||
* @implements Middleware | ||
* Middleware | ||
* Class representing RedirectHandler | ||
@@ -24,6 +24,5 @@ */ | ||
* | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of RedirectHandler | ||
* @param {RedirectHandlerOptions} [options = new RedirectHandlerOptions()] - The redirect handler options instance | ||
* @param [options] - The redirect handler options instance | ||
* @returns An instance of RedirectHandler | ||
@@ -38,5 +37,5 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To check whether the response has the redirect status code or not | ||
* @param {Response} response - The response object | ||
* @param response - The response object | ||
* @returns A boolean representing whether the response contains the redirect status code or not | ||
@@ -48,5 +47,5 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To check whether the response has location header or not | ||
* @param {Response} response - The response object | ||
* @param response - The response object | ||
* @returns A boolean representing the whether the response has location header or not | ||
@@ -58,5 +57,5 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To get the redirect url from location header in response object | ||
* @param {Response} response - The response object | ||
* @param response - The response object | ||
* @returns A redirect url from location header | ||
@@ -68,15 +67,15 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To check whether the given url is a relative url or not | ||
* @param {string} url - The url string value | ||
* @param url - The url string value | ||
* @returns A boolean representing whether the given url is a relative url or not | ||
*/ | ||
isRelativeURL(url) { | ||
return url.indexOf("://") === -1; | ||
return !url.includes("://"); | ||
} | ||
/** | ||
* @private | ||
* | ||
* To check whether the authorization header in the request should be dropped for consequent redirected requests | ||
* @param {string} requestUrl - The request url value | ||
* @param {string} redirectUrl - The redirect url value | ||
* @param requestUrl - The request url value | ||
* @param redirectUrl - The redirect url value | ||
* @returns A boolean representing whether the authorization header in the request should be dropped for consequent redirected requests | ||
@@ -99,10 +98,9 @@ */ | ||
/** | ||
* @private | ||
* @async | ||
* To execute the next middleware and to handle in case of redirect response returned by the server | ||
* @param {Context} context - The context object | ||
* @param {number} redirectCount - The redirect count value | ||
* @param {Record<string, RequestOption>} [requestOptions = {}] - The request options | ||
* @param {RedirectHandlerOptions} currentOptions - The redirect handler options instance | ||
* @param {string} tracerName - The name to use for the tracer | ||
* @param url - The url string value | ||
* @param fetchRequestInit - The Fetch RequestInit object | ||
* @param redirectCount - The redirect count value | ||
* @param currentOptions - The redirect handler options instance | ||
* @param requestOptions - The request options | ||
* @param tracerName - The name to use for the tracer | ||
* @returns A promise that resolves to nothing | ||
@@ -119,3 +117,3 @@ */ | ||
if (response.status === RedirectHandler.STATUS_CODE_SEE_OTHER) { | ||
fetchRequestInit["method"] = HttpMethod.GET; | ||
fetchRequestInit.method = HttpMethod.GET; | ||
delete fetchRequestInit.body; | ||
@@ -151,7 +149,7 @@ } | ||
/** | ||
* @public | ||
* @async | ||
* To execute the current middleware | ||
* @param {Context} context - The context object of the request | ||
* @returns A Promise that resolves to nothing | ||
* Executes the request and returns a promise resolving the response. | ||
* @param url - The url for the request | ||
* @param requestInit - The Fetch RequestInit object. | ||
* @param requestOptions - The request options. | ||
* @returns A Promise that resolves to the response. | ||
*/ | ||
@@ -161,3 +159,3 @@ execute(url, requestInit, requestOptions) { | ||
let currentOptions = this.options; | ||
if (requestOptions && requestOptions[RedirectHandlerOptionKey]) { | ||
if (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions[RedirectHandlerOptionKey]) { | ||
currentOptions = requestOptions[RedirectHandlerOptionKey]; | ||
@@ -182,4 +180,2 @@ } | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the array of redirect status codes | ||
@@ -195,4 +191,2 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member holding SeeOther status code | ||
@@ -202,4 +196,2 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the name of the location header | ||
@@ -209,4 +201,2 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member representing the authorization header name | ||
@@ -216,4 +206,2 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the manual redirect value | ||
@@ -220,0 +208,0 @@ */ |
@@ -14,28 +14,21 @@ /** | ||
/** | ||
* @class | ||
* @implements Middleware | ||
* Middleware | ||
* Class for RetryHandler | ||
*/ | ||
export declare class RetryHandler implements Middleware { | ||
private options; | ||
private readonly options; | ||
/** | ||
* @private | ||
* @static | ||
* A list of status codes that needs to be retried | ||
*/ | ||
private static RETRY_STATUS_CODES; | ||
private static readonly RETRY_STATUS_CODES; | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the name of retry attempt header | ||
*/ | ||
private static RETRY_ATTEMPT_HEADER; | ||
private static readonly RETRY_ATTEMPT_HEADER; | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the name of retry after header | ||
*/ | ||
private static RETRY_AFTER_HEADER; | ||
private static readonly RETRY_AFTER_HEADER; | ||
/** | ||
* @private | ||
* | ||
* The next middleware in the middleware chain | ||
@@ -45,6 +38,5 @@ */ | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of RetryHandler | ||
* @param {RetryHandlerOptions} [options = new RetryHandlerOptions()] - The retry handler options value | ||
* @param [options] - The retry handler options value | ||
* @returns An instance of RetryHandler | ||
@@ -55,5 +47,5 @@ */ | ||
* | ||
* @private | ||
* | ||
* To check whether the response has the retry status code | ||
* @param {Response} response - The response object | ||
* @param response - The response object | ||
* @returns Whether the response has retry status code or not | ||
@@ -63,5 +55,5 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To check whether the payload is buffered or not | ||
* @param {RequestInit} options - The options of a request | ||
* @param options - The options of a request | ||
* @returns Whether the payload is buffered or not | ||
@@ -71,7 +63,7 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To get the delay for a retry | ||
* @param {Response} response - The response object | ||
* @param {number} retryAttempts - The current attempt count | ||
* @param {number} delay - The delay value in seconds | ||
* @param response - The response object | ||
* @param retryAttempts - The current attempt count | ||
* @param delay - The delay value in seconds | ||
* @returns A delay for a retry | ||
@@ -81,5 +73,5 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To get an exponential back off value | ||
* @param {number} attempts - The current attempt count | ||
* @param attempts - The current attempt count | ||
* @returns An exponential back off value | ||
@@ -89,18 +81,15 @@ */ | ||
/** | ||
* @private | ||
* @async | ||
* To add delay for the execution | ||
* @param {number} delaySeconds - The delay value in seconds | ||
* @returns Nothing | ||
* @param delaySeconds - The delay value in seconds | ||
* @returns A Promise that resolves to nothing | ||
*/ | ||
private sleep; | ||
/** | ||
* @private | ||
* @async | ||
* To execute the middleware with retries | ||
* @param {Context} context - The context object | ||
* @param {number} retryAttempts - The current attempt count | ||
* @param {Record<string, RequestOption>} [requestOptions = {}] - The request options | ||
* @param {RetryHandlerOptions} currentOptions - The retry middleware options instance | ||
* @param {string} tracerName - The name to use for the tracer | ||
* @param url - The request url | ||
* @param fetchRequestInit - The request options | ||
* @param retryAttempts - The current attempt count | ||
* @param currentOptions - The current request options for the retry handler. | ||
* @param requestOptions - The retry middleware options instance | ||
* @param tracerName - The name to use for the tracer | ||
* @returns A Promise that resolves to nothing | ||
@@ -110,6 +99,6 @@ */ | ||
/** | ||
* @public | ||
* @async | ||
* To execute the current middleware | ||
* @param {Context} context - The context object of the request | ||
* @param url - The request url | ||
* @param requestInit - The request options | ||
* @param requestOptions - The request options | ||
* @returns A Promise that resolves to nothing | ||
@@ -116,0 +105,0 @@ */ |
@@ -16,4 +16,3 @@ /** | ||
/** | ||
* @class | ||
* @implements Middleware | ||
* Middleware | ||
* Class for RetryHandler | ||
@@ -23,6 +22,5 @@ */ | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* To create an instance of RetryHandler | ||
* @param {RetryHandlerOptions} [options = new RetryHandlerOptions()] - The retry handler options value | ||
* @param [options] - The retry handler options value | ||
* @returns An instance of RetryHandler | ||
@@ -38,5 +36,5 @@ */ | ||
* | ||
* @private | ||
* | ||
* To check whether the response has the retry status code | ||
* @param {Response} response - The response object | ||
* @param response - The response object | ||
* @returns Whether the response has retry status code or not | ||
@@ -48,5 +46,5 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To check whether the payload is buffered or not | ||
* @param {RequestInit} options - The options of a request | ||
* @param options - The options of a request | ||
* @returns Whether the payload is buffered or not | ||
@@ -67,7 +65,7 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To get the delay for a retry | ||
* @param {Response} response - The response object | ||
* @param {number} retryAttempts - The current attempt count | ||
* @param {number} delay - The delay value in seconds | ||
* @param response - The response object | ||
* @param retryAttempts - The current attempt count | ||
* @param delay - The delay value in seconds | ||
* @returns A delay for a retry | ||
@@ -96,5 +94,5 @@ */ | ||
/** | ||
* @private | ||
* | ||
* To get an exponential back off value | ||
* @param {number} attempts - The current attempt count | ||
* @param attempts - The current attempt count | ||
* @returns An exponential back off value | ||
@@ -106,7 +104,5 @@ */ | ||
/** | ||
* @private | ||
* @async | ||
* To add delay for the execution | ||
* @param {number} delaySeconds - The delay value in seconds | ||
* @returns Nothing | ||
* @param delaySeconds - The delay value in seconds | ||
* @returns A Promise that resolves to nothing | ||
*/ | ||
@@ -118,10 +114,9 @@ async sleep(delaySeconds) { | ||
/** | ||
* @private | ||
* @async | ||
* To execute the middleware with retries | ||
* @param {Context} context - The context object | ||
* @param {number} retryAttempts - The current attempt count | ||
* @param {Record<string, RequestOption>} [requestOptions = {}] - The request options | ||
* @param {RetryHandlerOptions} currentOptions - The retry middleware options instance | ||
* @param {string} tracerName - The name to use for the tracer | ||
* @param url - The request url | ||
* @param fetchRequestInit - The request options | ||
* @param retryAttempts - The current attempt count | ||
* @param currentOptions - The current request options for the retry handler. | ||
* @param requestOptions - The retry middleware options instance | ||
* @param tracerName - The name to use for the tracer | ||
* @returns A Promise that resolves to nothing | ||
@@ -165,6 +160,6 @@ */ | ||
/** | ||
* @public | ||
* @async | ||
* To execute the current middleware | ||
* @param {Context} context - The context object of the request | ||
* @param url - The request url | ||
* @param requestInit - The request options | ||
* @param requestOptions - The request options | ||
* @returns A Promise that resolves to nothing | ||
@@ -175,3 +170,3 @@ */ | ||
let currentOptions = this.options; | ||
if (requestOptions && requestOptions[RetryHandlerOptionKey]) { | ||
if (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions[RetryHandlerOptionKey]) { | ||
currentOptions = requestOptions[RetryHandlerOptionKey]; | ||
@@ -195,4 +190,2 @@ } | ||
/** | ||
* @private | ||
* @static | ||
* A list of status codes that needs to be retried | ||
@@ -206,4 +199,2 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the name of retry attempt header | ||
@@ -213,4 +204,2 @@ */ | ||
/** | ||
* @private | ||
* @static | ||
* A member holding the name of retry after header | ||
@@ -217,0 +206,0 @@ */ |
@@ -12,3 +12,3 @@ /** | ||
export declare class TelemetryHandler implements Middleware { | ||
private telemetryHandlerOptions; | ||
private readonly telemetryHandlerOptions; | ||
constructor(telemetryHandlerOptions: TelemetryHandlerOptions); | ||
@@ -15,0 +15,0 @@ next: Middleware | undefined; |
@@ -7,6 +7,7 @@ export const TelemetryHandlerOptionsKey = "TelemetryHandlerOptionsKey"; | ||
execute(url, requestInit, requestOptions) { | ||
if (this.telemetryHandlerOptions && this.telemetryHandlerOptions.telemetryConfigurator) { | ||
var _a; | ||
if ((_a = this.telemetryHandlerOptions) === null || _a === void 0 ? void 0 : _a.telemetryConfigurator) { | ||
this.telemetryHandlerOptions.telemetryConfigurator(url, requestInit, requestOptions, this.telemetryHandlerOptions.telemetryInformation); | ||
} | ||
else if (requestOptions && requestOptions[TelemetryHandlerOptionsKey]) { | ||
else if (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions[TelemetryHandlerOptionsKey]) { | ||
requestOptions[TelemetryHandlerOptionsKey].telemetryConfigurator(url, requestInit, requestOptions); | ||
@@ -13,0 +14,0 @@ } |
@@ -16,6 +16,5 @@ /** | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* Creates a new instance of the UrlReplaceHandler class | ||
* @param {UrlReplaceHandlerOptions} handlerOptions The options for the url replace handler. | ||
* @param handlerOptions The options for the url replace handler. | ||
* @returns An instance of the UrlReplaceHandler class | ||
@@ -28,5 +27,5 @@ */ | ||
*/ | ||
execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption> | undefined): Promise<Response>; | ||
execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption>): Promise<Response>; | ||
private replaceTokensInUrl; | ||
} | ||
//# sourceMappingURL=urlReplaceHandler.d.ts.map |
@@ -15,6 +15,5 @@ /** | ||
/** | ||
* @public | ||
* @constructor | ||
* | ||
* Creates a new instance of the UrlReplaceHandler class | ||
* @param {UrlReplaceHandlerOptions} handlerOptions The options for the url replace handler. | ||
* @param handlerOptions The options for the url replace handler. | ||
* @returns An instance of the UrlReplaceHandler class | ||
@@ -33,3 +32,3 @@ */ | ||
let currentOptions = this.handlerOptions; | ||
if (requestOptions && requestOptions[UrlReplaceHandlerOptionsKey]) { | ||
if (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions[UrlReplaceHandlerOptionsKey]) { | ||
currentOptions = requestOptions[UrlReplaceHandlerOptionsKey]; | ||
@@ -36,0 +35,0 @@ } |
@@ -16,6 +16,4 @@ /** | ||
/** | ||
* @public | ||
* @constructor | ||
* To create an instance of UserAgentHandler | ||
* @param {UserAgentHandlerOption} [options = new UserAgentHandlerOption()] - The options for the middleware | ||
* @param _options - The options for the middleware | ||
*/ | ||
@@ -26,5 +24,5 @@ constructor(_options?: UserAgentHandlerOptions); | ||
/** @inheritdoc */ | ||
execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption> | undefined): Promise<Response>; | ||
execute(url: string, requestInit: RequestInit, requestOptions?: Record<string, RequestOption>): Promise<Response>; | ||
private addValue; | ||
} | ||
//# sourceMappingURL=userAgentHandler.d.ts.map |
@@ -14,6 +14,4 @@ /** | ||
/** | ||
* @public | ||
* @constructor | ||
* To create an instance of UserAgentHandler | ||
* @param {UserAgentHandlerOption} [options = new UserAgentHandlerOption()] - The options for the middleware | ||
* @param _options - The options for the middleware | ||
*/ | ||
@@ -44,3 +42,3 @@ constructor(_options = new UserAgentHandlerOptions()) { | ||
let currentOptions = this._options; | ||
if (requestOptions && requestOptions[UserAgentHandlerOptionsKey]) { | ||
if (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions[UserAgentHandlerOptionsKey]) { | ||
currentOptions = requestOptions[UserAgentHandlerOptionsKey]; | ||
@@ -51,3 +49,3 @@ } | ||
const currentValue = getRequestHeader(requestInit, USER_AGENT_HEADER_KEY); | ||
if (!currentValue || currentValue.indexOf(additionalValue) === -1) { | ||
if (!(currentValue === null || currentValue === void 0 ? void 0 : currentValue.includes(additionalValue))) { | ||
appendRequestHeader(requestInit, USER_AGENT_HEADER_KEY, additionalValue, " "); | ||
@@ -54,0 +52,0 @@ } |
@@ -0,1 +1,7 @@ | ||
/** | ||
* ------------------------------------------------------------------------------------------- | ||
* 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"; | ||
@@ -19,4 +25,9 @@ /** Holds the tracing, metrics and logging configuration for the request adapter */ | ||
} | ||
/** | ||
* Gets the observability options from the request options | ||
* @param requestOptions The request options | ||
* @returns The observability options | ||
*/ | ||
export declare function getObservabilityOptionsFromRequest(requestOptions?: Record<string, RequestOption>): ObservabilityOptionsInternal | undefined; | ||
export {}; | ||
//# sourceMappingURL=observabilityOptions.d.ts.map |
@@ -19,2 +19,7 @@ export const ObservabilityOptionKey = "ObservabilityOptionKey"; | ||
} | ||
/** | ||
* Gets the observability options from the request options | ||
* @param requestOptions The request options | ||
* @returns The observability options | ||
*/ | ||
export function getObservabilityOptionsFromRequest(requestOptions) { | ||
@@ -21,0 +26,0 @@ if (requestOptions) { |
@@ -12,6 +12,5 @@ /** | ||
/** | ||
* @constant | ||
* To get the request header from the request | ||
* @param {FetchOptions|undefined} options - The request options object | ||
* @param {string} key - The header key string | ||
* @param options - The request options object | ||
* @param key - The header key string | ||
* @returns A header value for the given key from the request | ||
@@ -21,28 +20,22 @@ */ | ||
/** | ||
* @constant | ||
* To set the header value to the given request | ||
* @param {FetchOptions|undefined} options - The request options object | ||
* @param {string} key - The header key string | ||
* @param {string } value - The header value string | ||
* @returns Nothing | ||
* @param options - The request options object | ||
* @param key - The header key string | ||
* @param value - The header value string | ||
*/ | ||
export declare const setRequestHeader: (options: FetchRequestInit | undefined, key: string, value: string) => void; | ||
/** | ||
* @constant | ||
* To delete the header key to the given request | ||
* @param {FetchOptions|undefined} options - The request options object | ||
* @param {string} key - The header key string | ||
* @returns Nothing | ||
* @param options - The request options object | ||
* @param key - The header key string | ||
*/ | ||
export declare const deleteRequestHeader: (options: FetchRequestInit | undefined, key: string) => void; | ||
/** | ||
* @constant | ||
* To append the header value to the given request | ||
* @param {FetchOptions|undefined} options - The request options object | ||
* @param {string} key - The header key string | ||
* @param {string } value - The header value string | ||
* @param {string} separator - The separator string | ||
* @returns Nothing | ||
* @param options - The request options object | ||
* @param key - The header key string | ||
* @param value - The header value string | ||
* @param separator - The separator string | ||
*/ | ||
export declare const appendRequestHeader: (options: FetchRequestInit | undefined, key: string, value: string, separator?: string) => void; | ||
//# sourceMappingURL=headersUtil.d.ts.map |
@@ -11,6 +11,5 @@ /** | ||
/** | ||
* @constant | ||
* To get the request header from the request | ||
* @param {FetchOptions|undefined} options - The request options object | ||
* @param {string} key - The header key string | ||
* @param options - The request options object | ||
* @param key - The header key string | ||
* @returns A header value for the given key from the request | ||
@@ -25,8 +24,6 @@ */ | ||
/** | ||
* @constant | ||
* To set the header value to the given request | ||
* @param {FetchOptions|undefined} options - The request options object | ||
* @param {string} key - The header key string | ||
* @param {string } value - The header value string | ||
* @returns Nothing | ||
* @param options - The request options object | ||
* @param key - The header key string | ||
* @param value - The header value string | ||
*/ | ||
@@ -42,7 +39,5 @@ export const setRequestHeader = (options, key, value) => { | ||
/** | ||
* @constant | ||
* To delete the header key to the given request | ||
* @param {FetchOptions|undefined} options - The request options object | ||
* @param {string} key - The header key string | ||
* @returns Nothing | ||
* @param options - The request options object | ||
* @param key - The header key string | ||
*/ | ||
@@ -58,9 +53,7 @@ export const deleteRequestHeader = (options, key) => { | ||
/** | ||
* @constant | ||
* To append the header value to the given request | ||
* @param {FetchOptions|undefined} options - The request options object | ||
* @param {string} key - The header key string | ||
* @param {string } value - The header value string | ||
* @param {string} separator - The separator string | ||
* @returns Nothing | ||
* @param options - The request options object | ||
* @param key - The header key string | ||
* @param value - The header value string | ||
* @param separator - The separator string | ||
*/ | ||
@@ -67,0 +60,0 @@ export const appendRequestHeader = (options, key, value, separator = ", ") => { |
{ | ||
"name": "@microsoft/kiota-http-fetchlibrary", | ||
"version": "1.0.0-preview.72", | ||
"version": "1.0.0-preview.73", | ||
"description": "Kiota request adapter implementation with fetch", | ||
@@ -33,6 +33,7 @@ "keywords": [ | ||
"test:node": "vitest --run", | ||
"test:coverage": "vitest run --coverage.enabled --coverage.provider=istanbul", | ||
"test": "npm run test:node && npm run test:browser" | ||
}, | ||
"dependencies": { | ||
"@microsoft/kiota-abstractions": "^1.0.0-preview.72", | ||
"@microsoft/kiota-abstractions": "^1.0.0-preview.73", | ||
"@opentelemetry/api": "^1.7.0", | ||
@@ -45,3 +46,6 @@ "guid-typescript": "^1.0.9", | ||
}, | ||
"gitHead": "1dd543235361c045680e6171f0c5db6426c71cb5" | ||
"browserslist": [ | ||
"defaults" | ||
], | ||
"gitHead": "63db99a5b3c193335df834ca414fa9ea9361e1a0" | ||
} |
@@ -0,1 +1,3 @@ | ||
# Microsoft Kiota HTTP - Fetch library | ||
[![npm version badge](https://img.shields.io/npm/v/@microsoft/kiota-http-fetchlibrary?color=blue)](https://www.npmjs.com/package/@microsoft/kiota-http-fetchlibrary) | ||
@@ -12,1 +14,23 @@ | ||
1. `npm i @microsoft/kiota-http-fetchlibrary`. | ||
## Contributing | ||
This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us | ||
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>. | ||
When you submit a pull request, a CLA bot will automatically determine whether you need to provide | ||
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions | ||
provided by the bot. You will only need to do this once across all repos using our CLA. | ||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. | ||
## Trademarks | ||
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft | ||
trademarks or logos is subject to and must follow | ||
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). | ||
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. | ||
Any use of third-party trademarks or logos are subject to those third-party's policies. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
36
340268
3863