fix(http): don't encode values that are allowed in query (#9651)
This implements a new class, QueryEncoder, that provides methods for encoding keys and values of query parameter. The encoder encodes with encodeURIComponent, and then decodes a whitelist of allowed characters back to their unencoded form. BREAKING CHANGE: The changes to Http's URLSearchParams serialization now prevent encoding of these characters inside query parameters which were previously converted to percent-encoded values: @ : $ , ; + ; ? / The default encoding behavior can be overridden by extending QueryEncoder, as documented in the URLSearchParams service. Fixes #9348
This commit is contained in:
8
tools/public_api_guard/http/index.d.ts
vendored
8
tools/public_api_guard/http/index.d.ts
vendored
@ -100,6 +100,12 @@ export declare abstract class JSONPConnection implements Connection {
|
||||
abstract finished(data?: any): void;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare class QueryEncoder {
|
||||
encodeKey(k: string): string;
|
||||
encodeValue(v: string): string;
|
||||
}
|
||||
|
||||
/** @experimental */
|
||||
export declare enum ReadyState {
|
||||
Unsent = 0,
|
||||
@ -209,7 +215,7 @@ export declare enum ResponseType {
|
||||
export declare class URLSearchParams {
|
||||
paramsMap: Map<string, string[]>;
|
||||
rawParams: string;
|
||||
constructor(rawParams?: string);
|
||||
constructor(rawParams?: string, queryEncoder?: QueryEncoder);
|
||||
append(param: string, val: string): void;
|
||||
appendAll(searchParams: URLSearchParams): void;
|
||||
clone(): URLSearchParams;
|
||||
|
Reference in New Issue
Block a user