diff --git a/modules/angular2/src/http/interfaces.ts b/modules/angular2/src/http/interfaces.ts index 532860f7f8..fb362b3642 100644 --- a/modules/angular2/src/http/interfaces.ts +++ b/modules/angular2/src/http/interfaces.ts @@ -23,10 +23,10 @@ export abstract class Connection { } /** - * Interface for options to construct a Request, based on + * Interface for options to construct a RequestOptions, based on * [RequestInit](https://fetch.spec.whatwg.org/#requestinit) from the Fetch spec. */ -export type RequestOptionsArgs = { +export interface RequestOptionsArgs { url?: string; method?: string | RequestMethods; search?: string | URLSearchParams; @@ -35,6 +35,11 @@ export type RequestOptionsArgs = { body?: string; } +/** + * Required structure when constructing new Request(); + */ +export interface RequestArgs extends RequestOptionsArgs { url: string; } + /** * Interface for options to construct a Response, based on * [ResponseInit](https://fetch.spec.whatwg.org/#responseinit) from the Fetch spec. diff --git a/modules/angular2/src/http/static_request.ts b/modules/angular2/src/http/static_request.ts index 132ee44b07..3b09fe93f7 100644 --- a/modules/angular2/src/http/static_request.ts +++ b/modules/angular2/src/http/static_request.ts @@ -1,5 +1,5 @@ import {RequestMethods} from './enums'; -import {RequestOptions} from './base_request_options'; +import {RequestArgs} from './interfaces'; import {Headers} from './headers'; import {normalizeMethodName} from './http_utils'; import { @@ -61,7 +61,7 @@ export class Request { url: string; // TODO: support URLSearchParams | FormData | Blob | ArrayBuffer private _body: string; - constructor(requestOptions: RequestOptions) { + constructor(requestOptions: RequestArgs) { // TODO: assert that url is present let url = requestOptions.url; this.url = requestOptions.url;