2015-06-09 18:18:57 -04:00
|
|
|
/**
|
|
|
|
* @module
|
|
|
|
* @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-07-14 20:53:04 -04:00
|
|
|
import {Http, Jsonp} from 'angular2/src/http/http';
|
2015-06-09 18:18:57 -04:00
|
|
|
import {XHRBackend, XHRConnection} from 'angular2/src/http/backends/xhr_backend';
|
2015-07-14 20:53:04 -04:00
|
|
|
import {JSONPBackend, JSONPConnection} from 'angular2/src/http/backends/jsonp_backend';
|
2015-06-24 03:27:07 -04:00
|
|
|
import {BrowserXhr} from 'angular2/src/http/backends/browser_xhr';
|
2015-07-14 20:53:04 -04:00
|
|
|
import {BrowserJsonp} from 'angular2/src/http/backends/browser_jsonp';
|
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-06-19 15:29:11 -04:00
|
|
|
import {BaseResponseOptions, ResponseOptions} from 'angular2/src/http/base_response_options';
|
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-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
|
|
|
|
2015-06-19 15:29:11 -04:00
|
|
|
export {BrowserXhr} from 'angular2/src/http/backends/browser_xhr';
|
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-07-14 20:53:04 -04:00
|
|
|
export {JSONPBackend, JSONPConnection} from 'angular2/src/http/backends/jsonp_backend';
|
|
|
|
export {Http, Jsonp} 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';
|
2015-07-29 18:01:22 -04:00
|
|
|
* @Component({selector: 'http-app', viewBindings: [httpInjectables]})
|
2015-06-09 18:18:57 -04:00
|
|
|
* @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
|
|
|
|
];
|
2015-07-14 20:53:04 -04:00
|
|
|
|
|
|
|
export var jsonpInjectables: List<any> = [
|
|
|
|
bind(ConnectionBackend)
|
|
|
|
.toClass(JSONPBackend),
|
|
|
|
BrowserJsonp,
|
|
|
|
bind(RequestOptions).toClass(BaseRequestOptions),
|
|
|
|
bind(ResponseOptions).toClass(BaseResponseOptions),
|
|
|
|
Jsonp
|
|
|
|
];
|