1 | import { AbortSignal } from "./abort";
|
2 | /**
|
3 | * A collection of key/value pairs with case-insensitive keys.
|
4 | */
|
5 | export interface Headers extends Map<string, string> {
|
6 | /**
|
7 | * Returns a new instance of Headers with the specified header set to the
|
8 | * provided value. Does not modify the original Headers instance.
|
9 | *
|
10 | * @param headerName The name of the header to add or overwrite
|
11 | * @param headerValue The value to which the header should be set
|
12 | */
|
13 | withHeader(headerName: string, headerValue: string): Headers;
|
14 | /**
|
15 | * Returns a new instance of Headers without the specified header. Does not
|
16 | * modify the original Headers instance.
|
17 | *
|
18 | * @param headerName The name of the header to remove
|
19 | */
|
20 | withoutHeader(headerName: string): Headers;
|
21 | }
|
22 | /**
|
23 | * A mapping of header names to string values. Multiple values for the same
|
24 | * header should be represented as a single string with values separated by
|
25 | * `, `.
|
26 | *
|
27 | * Keys should be considered case insensitive, even if this is not enforced by a
|
28 | * particular implementation. For example, given the following HeaderBag, where
|
29 | * keys differ only in case:
|
30 | *
|
31 | * {
|
32 | * 'x-amz-date': '2000-01-01T00:00:00Z',
|
33 | * 'X-Amz-Date': '2001-01-01T00:00:00Z'
|
34 | * }
|
35 | *
|
36 | * The SDK may at any point during processing remove one of the object
|
37 | * properties in favor of the other. The headers may or may not be combined, and
|
38 | * the SDK will not deterministically select which header candidate to use.
|
39 | */
|
40 | export interface HeaderBag {
|
41 | [key: string]: string;
|
42 | }
|
43 | /**
|
44 | * Represents an HTTP message with headers and an optional static or streaming
|
45 | * body. bode: ArrayBuffer | ArrayBufferView | string | Uint8Array | Readable | ReadableStream;
|
46 | */
|
47 | export interface HttpMessage {
|
48 | headers: HeaderBag;
|
49 | body?: any;
|
50 | }
|
51 | /**
|
52 | * A mapping of query parameter names to strings or arrays of strings, with the
|
53 | * second being used when a parameter contains a list of values. Value can be set
|
54 | * to null when query is not in key-value pairs shape
|
55 | */
|
56 | export interface QueryParameterBag {
|
57 | [key: string]: string | Array<string> | null;
|
58 | }
|
59 | export interface Endpoint {
|
60 | protocol: string;
|
61 | hostname: string;
|
62 | port?: number;
|
63 | path: string;
|
64 | query?: QueryParameterBag;
|
65 | }
|
66 | /**
|
67 | * Interface an HTTP request class. Contains
|
68 | * addressing information in addition to standard message properties.
|
69 | */
|
70 | export interface HttpRequest extends HttpMessage, Endpoint {
|
71 | method: string;
|
72 | }
|
73 | /**
|
74 | * Represents an HTTP message as received in reply to a request. Contains a
|
75 | * numeric status code in addition to standard message properties.
|
76 | */
|
77 | export interface HttpResponse extends HttpMessage {
|
78 | statusCode: number;
|
79 | }
|
80 | /**
|
81 | * Represents HTTP message whose body has been resolved to a string. This is
|
82 | * used in parsing http message.
|
83 | */
|
84 | export interface ResolvedHttpResponse extends HttpResponse {
|
85 | body: string;
|
86 | }
|
87 | /**
|
88 | * Represents the options that may be passed to an Http Handler.
|
89 | */
|
90 | export interface HttpHandlerOptions {
|
91 | abortSignal?: AbortSignal;
|
92 | }
|