parent
74b311a472
commit
6fac901151
@ -43,6 +43,8 @@ export class XHRConnection implements Connection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ObservableWrapper.callNext(this.response, new Response(responseOptions));
|
ObservableWrapper.callNext(this.response, new Response(responseOptions));
|
||||||
|
// TODO(gdi2290): defer complete if array buffer until done
|
||||||
|
ObservableWrapper.callReturn(this.response);
|
||||||
});
|
});
|
||||||
// TODO(jeffbcross): make this more dynamic based on body type
|
// TODO(jeffbcross): make this more dynamic based on body type
|
||||||
|
|
||||||
|
@ -95,6 +95,16 @@ export function main() {
|
|||||||
existingXHRs[0].dispatchEvent('load');
|
existingXHRs[0].dispatchEvent('load');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should complete a request', inject([AsyncTestCompleter], async => {
|
||||||
|
var connection = new XHRConnection(sampleRequest, new MockBrowserXHR(),
|
||||||
|
new ResponseOptions({type: ResponseTypes.Error}));
|
||||||
|
ObservableWrapper.subscribe<Response>(connection.response, res => {
|
||||||
|
expect(res.type).toBe(ResponseTypes.Error);
|
||||||
|
}, null, () => { async.done(); });
|
||||||
|
|
||||||
|
existingXHRs[0].dispatchEvent('load');
|
||||||
|
}));
|
||||||
|
|
||||||
it('should call abort when disposed', () => {
|
it('should call abort when disposed', () => {
|
||||||
var connection = new XHRConnection(sampleRequest, new MockBrowserXHR());
|
var connection = new XHRConnection(sampleRequest, new MockBrowserXHR());
|
||||||
connection.dispose();
|
connection.dispose();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user