2015-06-09 18:18:57 -04:00
|
|
|
/**
|
|
|
|
* @module
|
|
|
|
* @public
|
|
|
|
* @description
|
|
|
|
* The http module provides services to perform http requests. To get started, see the {@link Http}
|
|
|
|
* class.
|
|
|
|
*/
|
2015-04-29 02:07:55 -04:00
|
|
|
import {bind, Binding} from 'angular2/di';
|
2015-06-24 03:27:07 -04:00
|
|
|
import {Http} from 'angular2/src/http/http';
|
2015-06-09 18:18:57 -04:00
|
|
|
import {XHRBackend, XHRConnection} from 'angular2/src/http/backends/xhr_backend';
|
2015-06-24 03:27:07 -04:00
|
|
|
import {BrowserXhr} from 'angular2/src/http/backends/browser_xhr';
|
2015-06-09 18:18:57 -04:00
|
|
|
import {BaseRequestOptions, RequestOptions} from 'angular2/src/http/base_request_options';
|
2015-06-19 15:14:12 -04:00
|
|
|
import {ConnectionBackend} from 'angular2/src/http/interfaces';
|
2015-04-29 02:07:55 -04:00
|
|
|
|
2015-06-09 18:18:57 -04:00
|
|
|
export {MockConnection, MockBackend} from 'angular2/src/http/backends/mock_backend';
|
|
|
|
export {Request} from 'angular2/src/http/static_request';
|
|
|
|
export {Response} from 'angular2/src/http/static_response';
|
2015-06-24 03:27:07 -04:00
|
|
|
import {BaseResponseOptions, ResponseOptions} from 'angular2/src/http/base_response_options';
|
2015-06-09 18:18:57 -04:00
|
|
|
|
2015-06-16 13:46:12 -04:00
|
|
|
export {
|
|
|
|
IRequestOptions,
|
2015-06-24 03:27:07 -04:00
|
|
|
IResponseOptions,
|
2015-06-16 13:46:12 -04:00
|
|
|
Connection,
|
|
|
|
ConnectionBackend
|
|
|
|
} from 'angular2/src/http/interfaces';
|
2015-06-19 15:14:12 -04:00
|
|
|
|
|
|
|
export {BaseRequestOptions, RequestOptions} from 'angular2/src/http/base_request_options';
|
2015-06-24 03:27:07 -04:00
|
|
|
export {BaseResponseOptions, ResponseOptions} from 'angular2/src/http/base_response_options';
|
2015-06-19 15:14:12 -04:00
|
|
|
export {XHRBackend, XHRConnection} from 'angular2/src/http/backends/xhr_backend';
|
2015-06-24 03:27:07 -04:00
|
|
|
export {Http} from 'angular2/src/http/http';
|
2015-06-19 15:14:12 -04:00
|
|
|
|
2015-06-09 18:18:57 -04:00
|
|
|
export {Headers} from 'angular2/src/http/headers';
|
|
|
|
|
2015-06-24 03:27:07 -04:00
|
|
|
export {
|
|
|
|
ResponseTypes,
|
|
|
|
ReadyStates,
|
|
|
|
RequestMethods,
|
|
|
|
RequestCredentialsOpts,
|
|
|
|
RequestCacheOpts,
|
|
|
|
RequestModesOpts
|
|
|
|
} from 'angular2/src/http/enums';
|
2015-06-16 13:46:12 -04:00
|
|
|
export {URLSearchParams} from 'angular2/src/http/url_search_params';
|
|
|
|
|
2015-06-09 18:18:57 -04:00
|
|
|
/**
|
|
|
|
* Provides a basic set of injectables to use the {@link Http} service in any application.
|
|
|
|
*
|
|
|
|
* #Example
|
|
|
|
*
|
|
|
|
* ```
|
|
|
|
* import {httpInjectables, Http} from 'angular2/http';
|
|
|
|
* @Component({selector: 'http-app', appInjector: [httpInjectables]})
|
|
|
|
* @View({template: '{{data}}'})
|
|
|
|
* class MyApp {
|
|
|
|
* constructor(http:Http) {
|
|
|
|
* http.request('data.txt').subscribe(res => this.data = res.text());
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
*/
|
2015-06-24 03:27:07 -04:00
|
|
|
export var httpInjectables: List<any> = [
|
|
|
|
bind(ConnectionBackend)
|
|
|
|
.toClass(XHRBackend),
|
|
|
|
BrowserXhr,
|
|
|
|
bind(RequestOptions).toClass(BaseRequestOptions),
|
|
|
|
bind(ResponseOptions).toClass(BaseResponseOptions),
|
|
|
|
Http
|
|
|
|
];
|