/** * ------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. * See License in the project root for license information. * ------------------------------------------------------------------------------------------- */ /** * @module ChaosHandler */ import type { RequestOption } from "@microsoft/kiota-abstractions"; import type { Middleware } from "./middleware.js"; import type { ChaosHandlerOptions } from "./options/chaosHandlerOptions.js"; /** * * Class * Middleware * Class representing RedirectHandler */ export declare class ChaosHandler implements Middleware { /** * A member holding options to customize the handler behavior */ options: ChaosHandlerOptions; /** * container for the manual map that has been written by the client */ private readonly manualMap; /** @inheritdoc */ next: Middleware | undefined; /** * * To create an instance of ChaosHandler * @param [options] - The chaos handler options instance * @param manualMap - The Map passed by user containing url-statusCode info */ constructor(options?: Partial, manualMap?: Map>); /** * Fetches a random status code for the RANDOM mode from the predefined array * @param requestMethod - the API method for the request * @returns a random status code from a given set of status codes */ private generateRandomStatusCode; /** * Strips out the host url and returns the relative url only * @param chaosHandlerOptions - The ChaosHandlerOptions object * @param urlMethod - the complete URL * @returns the string as relative URL */ private getRelativeURL; /** * Gets a status code from the options or a randomly generated status code * @param chaosHandlerOptions - The ChaosHandlerOptions object * @param requestURL - the URL for the request * @param requestMethod - the API method for the request * @returns generated statusCode */ private getStatusCode; /** * Generates a respondy for the chaoe response * @param chaosHandlerOptions - The ChaosHandlerOptions object * @param statusCode - the status code for the response * @returns the response body */ private createResponseBody; /** * Composes a new chaotic response code with the configured parameters * @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): Promise; static readonly chaosHandlerTriggeredEventKey = "com.microsoft.kiota.chaos_handler_triggered"; private runChaos; } //# sourceMappingURL=chaosHandler.d.ts.map