diff options
| author | ztplz <mysticzt@gmail.com> | 2018-09-30 22:31:50 +0800 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2018-09-30 10:31:50 -0400 |
| commit | b635553fd7eaca4bd27c4242935984bdb8e9365f (patch) | |
| tree | ac850111597d0ddb4f78dc059685d35ab09f1f64 /js/dom_types.ts | |
| parent | 77e876388bf1b2b3959f25a1cb057a1f96c76ba7 (diff) | |
Improve fetch headers (#853)
Diffstat (limited to 'js/dom_types.ts')
| -rw-r--r-- | js/dom_types.ts | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/js/dom_types.ts b/js/dom_types.ts index e1fa235bb..e3f75e488 100644 --- a/js/dom_types.ts +++ b/js/dom_types.ts @@ -13,7 +13,8 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. *******************************************************************************/ -export type HeadersInit = string[][] | Record<string, string>; +export type HeadersInit = Headers | string[][] | Record<string, string>; +export type URLSearchParamsInit = string | string[][] | Record<string, string>; type BodyInit = | Blob | BufferSource @@ -74,7 +75,7 @@ export interface ProgressEventInit extends EventInit { total?: number; } -interface URLSearchParams { +export interface URLSearchParams { /** * Appends a specified key/value pair as a new search parameter. */ @@ -101,7 +102,20 @@ interface URLSearchParams { * If there were several values, delete the others. */ set(name: string, value: string): void; + /** + * Sort all key/value pairs contained in this object in place + * and return undefined. The sort order is according to Unicode + * code points of the keys. + */ sort(): void; + /** + * Returns a query string suitable for use in a URL. + */ + toString(): string; + /** + * Iterates over each name-value pair in the query + * and invokes the given function. + */ forEach( callbackfn: (value: string, key: string, parent: URLSearchParams) => void, // tslint:disable-next-line:no-any |
