diff --git a/modules/@angular/http/http.ts b/modules/@angular/http/http.ts index bc77731c94..e283859ac7 100644 --- a/modules/@angular/http/http.ts +++ b/modules/@angular/http/http.ts @@ -16,64 +16,22 @@ import {NgModule} from '@angular/core'; import {BrowserJsonp} from './src/backends/browser_jsonp'; import {BrowserXhr} from './src/backends/browser_xhr'; -import {JSONPBackend, JSONPBackend_, JSONPConnection} from './src/backends/jsonp_backend'; -import {CookieXSRFStrategy, XHRBackend, XHRConnection} from './src/backends/xhr_backend'; +import {JSONPBackend, JSONPBackend_} from './src/backends/jsonp_backend'; +import {CookieXSRFStrategy, XHRBackend} from './src/backends/xhr_backend'; import {BaseRequestOptions, RequestOptions} from './src/base_request_options'; import {BaseResponseOptions, ResponseOptions} from './src/base_response_options'; import {Http, Jsonp} from './src/http'; -import {ConnectionBackend, XSRFStrategy} from './src/interfaces'; +import {XSRFStrategy} from './src/interfaces'; -export {BrowserXhr} from './src/backends/browser_xhr'; -export {JSONPBackend, JSONPConnection} from './src/backends/jsonp_backend'; -export {CookieXSRFStrategy, XHRBackend, XHRConnection} from './src/backends/xhr_backend'; -export {BaseRequestOptions, RequestOptions} from './src/base_request_options'; -export {BaseResponseOptions, ResponseOptions} from './src/base_response_options'; -export {ReadyState, RequestMethod, ResponseContentType, ResponseType} from './src/enums'; -export {Headers} from './src/headers'; -export {Http, Jsonp} from './src/http'; -export {Connection, ConnectionBackend, RequestOptionsArgs, ResponseOptionsArgs, XSRFStrategy} from './src/interfaces'; -export {Request} from './src/static_request'; -export {Response} from './src/static_response'; -export {QueryEncoder, URLSearchParams} from './src/url_search_params'; -const HTTP_PROVIDERS: any[] = [ - // TODO(pascal): use factory type annotations once supported in DI - // issue: https://github.com/angular/angular/issues/3183 - {provide: Http, useFactory: httpFactory, deps: [XHRBackend, RequestOptions]}, - BrowserXhr, - {provide: RequestOptions, useClass: BaseRequestOptions}, - {provide: ResponseOptions, useClass: BaseResponseOptions}, - XHRBackend, - {provide: XSRFStrategy, useFactory: _createDefaultCookieXSRFStrategy}, -]; - -/** - * @experimental - */ export function _createDefaultCookieXSRFStrategy() { return new CookieXSRFStrategy(); } -/** - * @experimental - */ export function httpFactory(xhrBackend: XHRBackend, requestOptions: RequestOptions): Http { return new Http(xhrBackend, requestOptions); } -const JSONP_PROVIDERS: any[] = [ - // TODO(pascal): use factory type annotations once supported in DI - // issue: https://github.com/angular/angular/issues/3183 - {provide: Jsonp, useFactory: jsonpFactory, deps: [JSONPBackend, RequestOptions]}, - BrowserJsonp, - {provide: RequestOptions, useClass: BaseRequestOptions}, - {provide: ResponseOptions, useClass: BaseResponseOptions}, - {provide: JSONPBackend, useClass: JSONPBackend_}, -]; - -/** - * @experimental - */ export function jsonpFactory(jsonpBackend: JSONPBackend, requestOptions: RequestOptions): Jsonp { return new Jsonp(jsonpBackend, requestOptions); } @@ -85,7 +43,6 @@ export function jsonpFactory(jsonpBackend: JSONPBackend, requestOptions: Request * @experimental */ @NgModule({ - // TODO(alxhub): switch back to HTTP_PROVIDERS when the metadata collector can inline it providers: [ // TODO(pascal): use factory type annotations once supported in DI // issue: https://github.com/angular/angular/issues/3183 @@ -106,7 +63,6 @@ export class HttpModule { * @experimental */ @NgModule({ - // TODO(alxhub): switch back to JSONP_PROVIDERS when the metadata collector can inline it providers: [ // TODO(pascal): use factory type annotations once supported in DI // issue: https://github.com/angular/angular/issues/3183 diff --git a/modules/@angular/http/index.ts b/modules/@angular/http/index.ts index 4ffa4bc5a1..21456844e7 100644 --- a/modules/@angular/http/index.ts +++ b/modules/@angular/http/index.ts @@ -6,4 +6,16 @@ * found in the LICENSE file at https://angular.io/license */ -export * from './http'; +export {HttpModule, JsonpModule} from './http'; +export {BrowserXhr} from './src/backends/browser_xhr'; +export {JSONPBackend, JSONPConnection} from './src/backends/jsonp_backend'; +export {CookieXSRFStrategy, XHRBackend, XHRConnection} from './src/backends/xhr_backend'; +export {BaseRequestOptions, RequestOptions} from './src/base_request_options'; +export {BaseResponseOptions, ResponseOptions} from './src/base_response_options'; +export {ReadyState, RequestMethod, ResponseContentType, ResponseType} from './src/enums'; +export {Headers} from './src/headers'; +export {Http, Jsonp} from './src/http'; +export {Connection, ConnectionBackend, RequestOptionsArgs, ResponseOptionsArgs, XSRFStrategy} from './src/interfaces'; +export {Request} from './src/static_request'; +export {Response} from './src/static_response'; +export {QueryEncoder, URLSearchParams} from './src/url_search_params'; diff --git a/modules/@angular/http/test/http_spec.ts b/modules/@angular/http/test/http_spec.ts index 97478f937a..3be5a2ce1d 100644 --- a/modules/@angular/http/test/http_spec.ts +++ b/modules/@angular/http/test/http_spec.ts @@ -13,7 +13,7 @@ import {expect} from '@angular/platform-browser/testing/matchers'; import {Observable} from 'rxjs/Observable'; import {zip} from 'rxjs/observable/zip'; -import {BaseRequestOptions, ConnectionBackend, Http, HttpModule, JSONPBackend, Jsonp, JsonpModule, Request, RequestMethod, RequestOptions, Response, ResponseContentType, ResponseOptions, URLSearchParams, XHRBackend} from '../http'; +import {BaseRequestOptions, ConnectionBackend, Http, HttpModule, JSONPBackend, Jsonp, JsonpModule, Request, RequestMethod, RequestOptions, Response, ResponseContentType, ResponseOptions, URLSearchParams, XHRBackend} from '../index'; import {Json} from '../src/facade/lang'; import {stringToArrayBuffer} from '../src/http_utils'; import {MockBackend, MockConnection} from '../testing/mock_backend'; diff --git a/tools/public_api_guard/http/index.d.ts b/tools/public_api_guard/http/index.d.ts index b015b83b3d..bc45296ac1 100644 --- a/tools/public_api_guard/http/index.d.ts +++ b/tools/public_api_guard/http/index.d.ts @@ -1,6 +1,3 @@ -/** @experimental */ -export declare function _createDefaultCookieXSRFStrategy(): CookieXSRFStrategy; - /** @experimental */ export declare class BaseRequestOptions extends RequestOptions { constructor(); @@ -71,9 +68,6 @@ export declare class Http { request(url: string | Request, options?: RequestOptionsArgs): Observable; } -/** @experimental */ -export declare function httpFactory(xhrBackend: XHRBackend, requestOptions: RequestOptions): Http; - /** @experimental */ export declare class HttpModule { } @@ -96,9 +90,6 @@ export declare abstract class JSONPConnection implements Connection { abstract finished(data?: any): void; } -/** @experimental */ -export declare function jsonpFactory(jsonpBackend: JSONPBackend, requestOptions: RequestOptions): Jsonp; - /** @experimental */ export declare class JsonpModule { }