BaseResponseOptions

export class BaseResponseOptions

exported from angular2/http defined in angular2/src/http/base_response_options.ts (line 102)

Subclass of ResponseOptions, with default values.

Default values:

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

Example (live demo)

import {provide} from 'angular2/core'; import {bootstrap} from 'angular2/platform/browser'; import {HTTP_PROVIDERS, Headers, Http, BaseResponseOptions, ResponseOptions} from 'angular2/http'; import {App} from './myapp'; class MyOptions extends BaseResponseOptions { headers:Headers = new Headers({network: 'github'}); } bootstrap(App, [HTTP_PROVIDERS, provide(ResponseOptions, {useClass: MyOptions})]);

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

Example (live demo)

import {BaseResponseOptions, Response} from 'angular2/http'; var options = new BaseResponseOptions(); var res = new Response(options.merge({ body: 'Angular2', headers: new Headers({framework: 'angular'}) })); console.log('res.headers.get("framework"):', res.headers.get('framework')); // angular console.log('res.text():', res.text()); // Angular2;

Annotations

@Injectable()

Constructor

constructor()

Not Yet Documented