refactor(http): rename enums to be singular

ReadyStates -> ReadyState
RequestMethods -> RequestMethod
ResponseTypes -> ResponseType

Fixes #5574

BREAKING CHANGE:

Before

import {ReadyStates, RequestMethods, ResponseTypes} from 'angular2/http';

After

import {ReadyState, RequestMethod, ResponseType} from 'angular2/http';

Closes #5584
This commit is contained in:
cexbrayat
2015-12-03 22:44:14 +01:00
committed by Cédric Exbrayat
parent 654496b315
commit b925ff5b8d
17 changed files with 100 additions and 100 deletions

View File

@ -1,7 +1,7 @@
import {Injectable} from 'angular2/core';
import {Request} from '../static_request';
import {Response} from '../static_response';
import {ReadyStates} from '../enums';
import {ReadyState} from '../enums';
import {Connection, ConnectionBackend} from '../interfaces';
import {isPresent} from 'angular2/src/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
@ -21,7 +21,7 @@ export class MockConnection implements Connection {
* Describes the state of the connection, based on `XMLHttpRequest.readyState`, but with
* additional states. For example, state 5 indicates an aborted connection.
*/
readyState: ReadyStates;
readyState: ReadyState;
/**
* {@link Request} instance used to create the connection.
@ -36,7 +36,7 @@ export class MockConnection implements Connection {
constructor(req: Request) {
this.response = new ReplaySubject(1).take(1);
this.readyState = ReadyStates.Open;
this.readyState = ReadyState.Open;
this.request = req;
}
@ -55,10 +55,10 @@ export class MockConnection implements Connection {
*
*/
mockRespond(res: Response) {
if (this.readyState === ReadyStates.Done || this.readyState === ReadyStates.Cancelled) {
if (this.readyState === ReadyState.Done || this.readyState === ReadyState.Cancelled) {
throw new BaseException('Connection has already been resolved');
}
this.readyState = ReadyStates.Done;
this.readyState = ReadyState.Done;
this.response.next(res);
this.response.complete();
}
@ -84,7 +84,7 @@ export class MockConnection implements Connection {
*/
mockError(err?: Error) {
// Matches XHR semantics
this.readyState = ReadyStates.Done;
this.readyState = ReadyState.Done;
this.response.error(err);
}
}