1
|
/**
|
2
|
* @experimental
|
3
|
**/
|
4
|
export declare class QueryEncoder {
|
5
|
encodeKey(k: string): string;
|
6
|
encodeValue(v: string): string;
|
7
|
}
|
8
|
/**
|
9
|
* Map-like representation of url search parameters, based on
|
10
|
* [URLSearchParams](https://url.spec.whatwg.org/#urlsearchparams) in the url living standard,
|
11
|
* with several extensions for merging URLSearchParams objects:
|
12
|
* - setAll()
|
13
|
* - appendAll()
|
14
|
* - replaceAll()
|
15
|
*
|
16
|
* This class accepts an optional second parameter of ${@link QueryEncoder},
|
17
|
* which is used to serialize parameters before making a request. By default,
|
18
|
* `QueryEncoder` encodes keys and values of parameters using `encodeURIComponent`,
|
19
|
* and then un-encodes certain characters that are allowed to be part of the query
|
20
|
* according to IETF RFC 3986: https://tools.ietf.org/html/rfc3986.
|
21
|
*
|
22
|
* These are the characters that are not encoded: `! $ \' ( ) * + , ; A 9 - . _ ~ ? /`
|
23
|
*
|
24
|
* If the set of allowed query characters is not acceptable for a particular backend,
|
25
|
* `QueryEncoder` can be subclassed and provided as the 2nd argument to URLSearchParams.
|
26
|
*
|
27
|
* ```
|
28
|
* import {URLSearchParams, QueryEncoder} from '@angular/http';
|
29
|
* class MyQueryEncoder extends QueryEncoder {
|
30
|
* encodeKey(k: string): string {
|
31
|
* return myEncodingFunction(k);
|
32
|
* }
|
33
|
*
|
34
|
* encodeValue(v: string): string {
|
35
|
* return myEncodingFunction(v);
|
36
|
* }
|
37
|
* }
|
38
|
*
|
39
|
* let params = new URLSearchParams('', new MyQueryEncoder());
|
40
|
* ```
|
41
|
* @experimental
|
42
|
*/
|
43
|
export declare class URLSearchParams {
|
44
|
rawParams: string;
|
45
|
private queryEncoder;
|
46
|
paramsMap: Map<string, string[]>;
|
47
|
constructor(rawParams?: string, queryEncoder?: QueryEncoder);
|
48
|
clone(): URLSearchParams;
|
49
|
has(param: string): boolean;
|
50
|
get(param: string): string | null;
|
51
|
getAll(param: string): string[];
|
52
|
set(param: string, val: string): void;
|
53
|
setAll(searchParams: URLSearchParams): void;
|
54
|
append(param: string, val: string): void;
|
55
|
appendAll(searchParams: URLSearchParams): void;
|
56
|
replaceAll(searchParams: URLSearchParams): void;
|
57
|
toString(): string;
|
58
|
delete(param: string): void;
|
59
|
}
|