refactor: remove some facades (#12335)
This commit is contained in:

committed by
Alex Rickabaugh

parent
0ecd9b2df0
commit
76dd026447
@ -8,7 +8,7 @@
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
|
||||
import {isPresent, isString} from '../src/facade/lang';
|
||||
import {isPresent} from '../src/facade/lang';
|
||||
|
||||
import {RequestMethod, ResponseContentType} from './enums';
|
||||
import {Headers} from './headers';
|
||||
@ -82,7 +82,8 @@ export class RequestOptions {
|
||||
this.body = isPresent(body) ? body : null;
|
||||
this.url = isPresent(url) ? url : null;
|
||||
this.search = isPresent(search) ?
|
||||
(isString(search) ? new URLSearchParams(<string>(search)) : <URLSearchParams>(search)) :
|
||||
(typeof search === 'string' ? new URLSearchParams(<string>(search)) :
|
||||
<URLSearchParams>(search)) :
|
||||
null;
|
||||
this.withCredentials = isPresent(withCredentials) ? withCredentials : null;
|
||||
this.responseType = isPresent(responseType) ? responseType : null;
|
||||
@ -115,19 +116,18 @@ export class RequestOptions {
|
||||
*/
|
||||
merge(options?: RequestOptionsArgs): RequestOptions {
|
||||
return new RequestOptions({
|
||||
method: isPresent(options) && isPresent(options.method) ? options.method : this.method,
|
||||
headers: isPresent(options) && isPresent(options.headers) ? options.headers : this.headers,
|
||||
body: isPresent(options) && isPresent(options.body) ? options.body : this.body,
|
||||
url: isPresent(options) && isPresent(options.url) ? options.url : this.url,
|
||||
search: isPresent(options) && isPresent(options.search) ?
|
||||
(isString(options.search) ? new URLSearchParams(<string>(options.search)) :
|
||||
(<URLSearchParams>(options.search)).clone()) :
|
||||
method: options && isPresent(options.method) ? options.method : this.method,
|
||||
headers: options && isPresent(options.headers) ? options.headers : this.headers,
|
||||
body: options && isPresent(options.body) ? options.body : this.body,
|
||||
url: options && isPresent(options.url) ? options.url : this.url,
|
||||
search: options && isPresent(options.search) ?
|
||||
(typeof options.search === 'string' ? new URLSearchParams(options.search) :
|
||||
(<URLSearchParams>(options.search)).clone()) :
|
||||
this.search,
|
||||
withCredentials: isPresent(options) && isPresent(options.withCredentials) ?
|
||||
options.withCredentials :
|
||||
this.withCredentials,
|
||||
responseType: isPresent(options) && isPresent(options.responseType) ? options.responseType :
|
||||
this.responseType
|
||||
withCredentials: options && isPresent(options.withCredentials) ? options.withCredentials :
|
||||
this.withCredentials,
|
||||
responseType: options && isPresent(options.responseType) ? options.responseType :
|
||||
this.responseType
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user