export class MockConnection
export class MockConnection
exported from angular2/http/testing defined in angular2/src/http/backends/mock_backend.ts (line 10)
Mock Connection to represent a Connection
for tests.
Constructor
constructor(req: Request)
constructor(req: Request)
Not Yet Documented
Members
readyState : ReadyState
readyState : ReadyState
Describes the state of the connection, based on XMLHttpRequest.readyState
, but with
additional states. For example, state 5 indicates an aborted connection.
request : Request
request : Request
Request
instance used to create the connection.
response : any
response : any
EventEmitter
of Response
. Can be subscribed to in order to be notified when a
response is available.
mockRespond(res: Response)
mockRespond(res: Response)
Sends a mock response to the connection. This response is the value that is emitted to the
EventEmitter
returned by Http
.
#
mockDownload(res: Response)
mockDownload(res: Response)
Not yet implemented!
Sends the provided Response
to the downloadObserver
of the Request
associated with this connection.
mockError(err?: Error)
mockError(err?: Error)
Emits the provided error object as an error to the Response
EventEmitter
returned
from Http
.