fix(http): Update types for TypeScript nullability support

This commit is contained in:
Miško Hevery
2017-04-14 13:53:25 -07:00
committed by Tobias Bosch
parent 86396a43e9
commit c36ec9bf60
18 changed files with 138 additions and 128 deletions
+7 -7
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) {