1
|
/**
|
2
|
* @license
|
3
|
* Copyright Google Inc. All Rights Reserved.
|
4
|
*
|
5
|
* Use of this source code is governed by an MIT-style license that can be
|
6
|
* found in the LICENSE file at https://angular.io/license
|
7
|
*/
|
8
|
import { ReadyState, RequestMethod, ResponseContentType, ResponseType } from './enums';
|
9
|
import { Headers } from './headers';
|
10
|
import { Request } from './static_request';
|
11
|
import { URLSearchParams } from './url_search_params';
|
12
|
/**
|
13
|
* Abstract class from which real backends are derived.
|
14
|
*
|
15
|
* The primary purpose of a `ConnectionBackend` is to create new connections to fulfill a given
|
16
|
* {@link Request}.
|
17
|
*
|
18
|
* @experimental
|
19
|
*/
|
20
|
export declare abstract class ConnectionBackend {
|
21
|
abstract createConnection(request: any): Connection;
|
22
|
}
|
23
|
/**
|
24
|
* Abstract class from which real connections are derived.
|
25
|
*
|
26
|
* @experimental
|
27
|
*/
|
28
|
export declare abstract class Connection {
|
29
|
readyState: ReadyState;
|
30
|
request: Request;
|
31
|
response: any;
|
32
|
}
|
33
|
/**
|
34
|
* An XSRFStrategy configures XSRF protection (e.g. via headers) on an HTTP request.
|
35
|
*
|
36
|
* @experimental
|
37
|
*/
|
38
|
export declare abstract class XSRFStrategy {
|
39
|
abstract configureRequest(req: Request): void;
|
40
|
}
|
41
|
/**
|
42
|
* Interface for options to construct a RequestOptions, based on
|
43
|
* [RequestInit](https://fetch.spec.whatwg.org/#requestinit) from the Fetch spec.
|
44
|
*
|
45
|
* @experimental
|
46
|
*/
|
47
|
export interface RequestOptionsArgs {
|
48
|
url?: string | null;
|
49
|
method?: string | RequestMethod | null;
|
50
|
/** @deprecated from 4.0.0. Use params instead. */
|
51
|
search?: string | URLSearchParams | {
|
52
|
[key: string]: any | any[];
|
53
|
} | null;
|
54
|
params?: string | URLSearchParams | {
|
55
|
[key: string]: any | any[];
|
56
|
} | null;
|
57
|
headers?: Headers | null;
|
58
|
body?: any;
|
59
|
withCredentials?: boolean | null;
|
60
|
responseType?: ResponseContentType | null;
|
61
|
}
|
62
|
/**
|
63
|
* Required structure when constructing new Request();
|
64
|
*/
|
65
|
export interface RequestArgs extends RequestOptionsArgs {
|
66
|
url: string | null;
|
67
|
}
|
68
|
/**
|
69
|
* Interface for options to construct a Response, based on
|
70
|
* [ResponseInit](https://fetch.spec.whatwg.org/#responseinit) from the Fetch spec.
|
71
|
*
|
72
|
* @experimental
|
73
|
*/
|
74
|
export interface ResponseOptionsArgs {
|
75
|
body?: string | Object | FormData | ArrayBuffer | Blob | null;
|
76
|
status?: number | null;
|
77
|
statusText?: string | null;
|
78
|
headers?: Headers | null;
|
79
|
type?: ResponseType | null;
|
80
|
url?: string | null;
|
81
|
}
|