/** * ------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. * See License in the project root for license information. * ------------------------------------------------------------------------------------------- */ /** * @module RedirectHandler */ import { type RequestOption } from "@microsoft/kiota-abstractions"; import type { Middleware } from "./middleware.js"; import { RedirectHandlerOptions } from "./options/redirectHandlerOptions.js"; /** * * Class * Middleware * Class representing RedirectHandler */ export declare class RedirectHandler implements Middleware { private readonly options; /** * A member holding the array of redirect status codes */ private static readonly REDIRECT_STATUS_CODES; /** * A member holding SeeOther status code */ private static readonly STATUS_CODE_SEE_OTHER; /** * A member holding the name of the location header */ private static readonly LOCATION_HEADER; /** * A member representing the authorization header name */ private static readonly AUTHORIZATION_HEADER; /** * A member holding the manual redirect value */ private static readonly MANUAL_REDIRECT; /** Next middleware to be executed*/ next: Middleware | undefined; /** * * * To create an instance of RedirectHandler * @param [options] - The redirect handler options instance * @returns An instance of RedirectHandler */ constructor(options?: RedirectHandlerOptions); /** * * To check whether the response has the redirect status code or not * @param response - The response object * @returns A boolean representing whether the response contains the redirect status code or not */ private isRedirect; /** * * To check whether the response has location header or not * @param response - The response object * @returns A boolean representing the whether the response has location header or not */ private hasLocationHeader; /** * * To get the redirect url from location header in response object * @param response - The response object * @returns A redirect url from location header */ private getLocationHeader; /** * * To check whether the given url is a relative url or not * @param url - The url string value * @returns A boolean representing whether the given url is a relative url or not */ private isRelativeURL; /** * * To check whether the authorization header in the request should be dropped for consequent redirected requests * @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 */ private shouldDropAuthorizationHeader; /** * To execute the next middleware and to handle in case of redirect response returned by the server * @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 */ private executeWithRedirect; /** * 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. */ execute(url: string, requestInit: RequestInit, requestOptions?: Record): Promise; } //# sourceMappingURL=redirectHandler.d.ts.map