chore(http): remove unused properties from Request
This removes properties mentioned in #3339 Closes #3339 Closes #3823
This commit is contained in:

committed by
Jeff Cross

parent
2acc1ad08b
commit
5a3ce87915
@ -1,6 +1,6 @@
|
||||
import {CONST_EXPR, CONST, isPresent, isString} from 'angular2/src/core/facade/lang';
|
||||
import {Headers} from './headers';
|
||||
import {RequestModesOpts, RequestMethods, RequestCacheOpts, RequestCredentialsOpts} from './enums';
|
||||
import {RequestMethods} from './enums';
|
||||
import {RequestOptionsArgs} from './interfaces';
|
||||
import {Injectable} from 'angular2/src/core/di';
|
||||
import {URLSearchParams} from './url_search_params';
|
||||
@ -30,19 +30,12 @@ export class RequestOptions {
|
||||
*/
|
||||
// TODO: support FormData, Blob, URLSearchParams
|
||||
body: string;
|
||||
mode: RequestModesOpts;
|
||||
credentials: RequestCredentialsOpts;
|
||||
cache: RequestCacheOpts;
|
||||
url: string;
|
||||
search: URLSearchParams;
|
||||
constructor({method, headers, body, mode, credentials, cache, url, search}:
|
||||
RequestOptionsArgs = {}) {
|
||||
constructor({method, headers, body, url, search}: RequestOptionsArgs = {}) {
|
||||
this.method = isPresent(method) ? method : null;
|
||||
this.headers = isPresent(headers) ? headers : null;
|
||||
this.body = isPresent(body) ? body : null;
|
||||
this.mode = isPresent(mode) ? mode : null;
|
||||
this.credentials = isPresent(credentials) ? credentials : null;
|
||||
this.cache = isPresent(cache) ? cache : null;
|
||||
this.url = isPresent(url) ? url : null;
|
||||
this.search = isPresent(search) ? (isString(search) ? new URLSearchParams(<string>(search)) :
|
||||
<URLSearchParams>(search)) :
|
||||
@ -58,10 +51,6 @@ export class 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,
|
||||
mode: isPresent(options) && isPresent(options.mode) ? options.mode : this.mode,
|
||||
credentials: isPresent(options) && isPresent(options.credentials) ? options.credentials :
|
||||
this.credentials,
|
||||
cache: isPresent(options) && isPresent(options.cache) ? options.cache : this.cache,
|
||||
url: isPresent(options) && isPresent(options.url) ? options.url : this.url,
|
||||
search: isPresent(options) && isPresent(options.search) ?
|
||||
(isString(options.search) ? new URLSearchParams(<string>(options.search)) :
|
||||
@ -91,7 +80,5 @@ export class RequestOptions {
|
||||
*/
|
||||
@Injectable()
|
||||
export class BaseRequestOptions extends RequestOptions {
|
||||
constructor() {
|
||||
super({method: RequestMethods.Get, headers: new Headers(), mode: RequestModesOpts.Cors});
|
||||
}
|
||||
constructor() { super({method: RequestMethods.Get, headers: new Headers()}); }
|
||||
}
|
||||
|
Reference in New Issue
Block a user