diff --git a/modules/angular2/src/http/backends/jsonp_backend.ts b/modules/angular2/src/http/backends/jsonp_backend.ts index 3cfbb29466..9ef2a8fa6c 100644 --- a/modules/angular2/src/http/backends/jsonp_backend.ts +++ b/modules/angular2/src/http/backends/jsonp_backend.ts @@ -1,5 +1,5 @@ import {ConnectionBackend, Connection} from '../interfaces'; -import {ReadyStates, RequestMethods, RequestMethodsMap} from '../enums'; +import {ReadyStates, RequestMethods} from '../enums'; import {Request} from '../static_request'; import {Response} from '../static_response'; import {ResponseOptions, BaseResponseOptions} from '../base_response_options'; diff --git a/modules/angular2/src/http/backends/xhr_backend.ts b/modules/angular2/src/http/backends/xhr_backend.ts index e5096520ac..3722382474 100644 --- a/modules/angular2/src/http/backends/xhr_backend.ts +++ b/modules/angular2/src/http/backends/xhr_backend.ts @@ -1,5 +1,5 @@ import {ConnectionBackend, Connection} from '../interfaces'; -import {ReadyStates, RequestMethods, RequestMethodsMap, ResponseTypes} from '../enums'; +import {ReadyStates, RequestMethods, ResponseTypes} from '../enums'; import {Request} from '../static_request'; import {Response} from '../static_response'; import {ResponseOptions, BaseResponseOptions} from '../base_response_options'; @@ -27,14 +27,11 @@ export class XHRConnection implements Connection { private _xhr; // TODO: make type XMLHttpRequest, pending resolution of // https://github.com/angular/ts2dart/issues/230 constructor(req: Request, browserXHR: BrowserXhr, baseResponseOptions?: ResponseOptions) { - // TODO: get rid of this when enum lookups are available in ts2dart - // https://github.com/angular/ts2dart/issues/221 - var requestMethodsMap = new RequestMethodsMap(); this.request = req; this.response = new EventEmitter(); this._xhr = browserXHR.build(); // TODO(jeffbcross): implement error listening/propagation - this._xhr.open(requestMethodsMap.getMethod(ENUM_INDEX(req.method)), req.url); + this._xhr.open(RequestMethods[ENUM_INDEX(req.method)], req.url); this._xhr.addEventListener('load', (_) => { // responseText is the old-school way of retrieving response (supported by IE8 & 9) // response/responseType properties were introduced in XHR Level2 spec (supported by IE10) diff --git a/modules/angular2/src/http/enums.ts b/modules/angular2/src/http/enums.ts index efdc8b6c78..1e0183ba66 100644 --- a/modules/angular2/src/http/enums.ts +++ b/modules/angular2/src/http/enums.ts @@ -46,13 +46,6 @@ export enum RequestMethods { PATCH } -// TODO: Remove this when enum lookups are available in ts2dart -// https://github.com/angular/ts2dart/issues/221 -export class RequestMethodsMap { - private _methods: List; - constructor() { this._methods = ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD', 'PATCH']; } - getMethod(method: number): string { return this._methods[method]; } -} /** * All possible states in which a connection can be, based on * [States](http://www.w3.org/TR/XMLHttpRequest/#states) from the `XMLHttpRequest` spec, but with an