fix(http): Update types for TypeScript nullability support

This reverts commit 268884296a.
This commit is contained in:
Miško Hevery
2017-04-17 11:12:53 -07:00
committed by Tobias Bosch
parent 014594fe8f
commit ec028b8109
18 changed files with 138 additions and 128 deletions

View File

@ -44,11 +44,11 @@ export class RequestOptions {
* Http method with which to execute a {@link Request}.
* Acceptable methods are defined in the {@link RequestMethod} enum.
*/
method: RequestMethod|string;
method: RequestMethod|string|null;
/**
* {@link Headers} to be attached to a {@link Request}.
*/
headers: Headers;
headers: Headers|null;
/**
* Body to be used when creating a {@link Request}.
*/
@ -56,7 +56,7 @@ export class RequestOptions {
/**
* Url with which to perform a {@link Request}.
*/
url: string;
url: string|null;
/**
* Search parameters to be included in a {@link Request}.
*/
@ -72,11 +72,11 @@ export class RequestOptions {
/**
* Enable use credentials for a {@link Request}.
*/
withCredentials: boolean;
withCredentials: boolean|null;
/*
* Select a buffer to store the response, such as ArrayBuffer, Blob, Json (or Document)
*/
responseType: ResponseContentType;
responseType: ResponseContentType|null;
// TODO(Dzmitry): remove search when this.search is removed
constructor(
@ -128,8 +128,8 @@ export class RequestOptions {
});
}
private _mergeSearchParams(params: string|URLSearchParams|
{[key: string]: any | any[]}): URLSearchParams {
private _mergeSearchParams(params?: string|URLSearchParams|{[key: string]: any | any[]}|
null): URLSearchParams {
if (!params) return this.params;
if (params instanceof URLSearchParams) {