UNPKG

1.91 kBTypeScriptView Raw
1/**
2 * -------------------------------------------------------------------------------------------
3 * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
4 * See License in the project root for license information.
5 * -------------------------------------------------------------------------------------------
6 */
7/**
8 * @module RedirectHandlerOptions
9 */
10import { MiddlewareOptions } from "./IMiddlewareOptions";
11/**
12 * @type
13 * A type declaration for shouldRetry callback
14 */
15export declare type ShouldRedirect = (response: Response) => boolean;
16/**
17 * @class
18 * @implements MiddlewareOptions
19 * A class representing RedirectHandlerOptions
20 */
21export declare class RedirectHandlerOptions implements MiddlewareOptions {
22 /**
23 * @private
24 * @static
25 * A member holding default max redirects value
26 */
27 private static DEFAULT_MAX_REDIRECTS;
28 /**
29 * @private
30 * @static
31 * A member holding maximum max redirects value
32 */
33 private static MAX_MAX_REDIRECTS;
34 /**
35 * @public
36 * A member holding max redirects value
37 */
38 maxRedirects: number;
39 /**
40 * @public
41 * A member holding shouldRedirect callback
42 */
43 shouldRedirect: ShouldRedirect;
44 /**
45 * @private
46 * A member holding default shouldRedirect callback
47 */
48 private static DEFAULT_SHOULD_RETRY;
49 /**
50 * @public
51 * @constructor
52 * To create an instance of RedirectHandlerOptions
53 * @param {number} [maxRedirects = RedirectHandlerOptions.DEFAULT_MAX_REDIRECTS] - The max redirects value
54 * @param {ShouldRedirect} [shouldRedirect = RedirectHandlerOptions.DEFAULT_SHOULD_RETRY] - The should redirect callback
55 * @returns An instance of RedirectHandlerOptions
56 */
57 constructor(maxRedirects?: number, shouldRedirect?: ShouldRedirect);
58}