UNPKG

2.25 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 MiddlewareUtil
9 */
10import { FetchOptions } from "../IFetchOptions";
11/**
12 * @constant
13 * To generate the UUID
14 * @returns The UUID string
15 */
16export declare const generateUUID: () => string;
17/**
18 * @constant
19 * To get the request header from the request
20 * @param {RequestInfo} request - The request object or the url string
21 * @param {FetchOptions|undefined} options - The request options object
22 * @param {string} key - The header key string
23 * @returns A header value for the given key from the request
24 */
25export declare const getRequestHeader: (request: RequestInfo, options: FetchOptions | undefined, key: string) => string | null;
26/**
27 * @constant
28 * To set the header value to the given request
29 * @param {RequestInfo} request - The request object or the url string
30 * @param {FetchOptions|undefined} options - The request options object
31 * @param {string} key - The header key string
32 * @param {string } value - The header value string
33 * @returns Nothing
34 */
35export declare const setRequestHeader: (request: RequestInfo, options: FetchOptions | undefined, key: string, value: string) => void;
36/**
37 * @constant
38 * To append the header value to the given request
39 * @param {RequestInfo} request - The request object or the url string
40 * @param {FetchOptions|undefined} options - The request options object
41 * @param {string} key - The header key string
42 * @param {string } value - The header value string
43 * @returns Nothing
44 */
45export declare const appendRequestHeader: (request: RequestInfo, options: FetchOptions | undefined, key: string, value: string) => void;
46/**
47 * @constant
48 * To clone the request with the new url
49 * @param {string} url - The new url string
50 * @param {Request} request - The request object
51 * @returns A promise that resolves to request object
52 */
53export declare const cloneRequestWithNewUrl: (newUrl: string, request: Request) => Promise<Request>;