BaseRequestOptions

export class BaseRequestOptions

exported from angular2/http defined in angular2/src/http/base_request_options.ts (line 103)

Subclass of RequestOptions, with default values.

Default values:

This class could be extended and bound to the RequestOptions class when configuring an Injector, in order to override the default options used by Http to create and send Requests.

Example (live demo)

import {provide} from 'angular2/core'; import {bootstrap} from 'angular2/platform/browser'; import {HTTP_PROVIDERS, Http, BaseRequestOptions, RequestOptions} from 'angular2/http'; import {App} from './myapp'; class MyOptions extends BaseRequestOptions { search: string = 'coreTeam=true'; } bootstrap(App, [HTTP_PROVIDERS, provide(RequestOptions, {useClass: MyOptions})]);

The options could also be extended when manually creating a Request object.

Example (live demo)

import {BaseRequestOptions, Request, RequestMethod} from 'angular2/http'; var options = new BaseRequestOptions(); var req = new Request(options.merge({ method: RequestMethod.Post, url: 'https://google.com' })); console.log('req.method:', RequestMethod[req.method]); // Post console.log('options.url:', options.url); // null console.log('req.url:', req.url); // https://google.com

Annotations

@Injectable()

Constructor

constructor()

Not Yet Documented