File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ export class XHRConnection implements Connection {
4343 }
4444
4545 ObservableWrapper . callNext ( this . response , new Response ( responseOptions ) ) ;
46+ // TODO(gdi2290): defer complete if array buffer until done
47+ ObservableWrapper . callReturn ( this . response ) ;
4648 } ) ;
4749 // TODO(jeffbcross): make this more dynamic based on body type
4850
Original file line number Diff line number Diff line change @@ -95,6 +95,16 @@ export function main() {
9595 existingXHRs [ 0 ] . dispatchEvent ( 'load' ) ;
9696 } ) ) ;
9797
98+ it ( 'should complete a request' , inject ( [ AsyncTestCompleter ] , async => {
99+ var connection = new XHRConnection ( sampleRequest , new MockBrowserXHR ( ) ,
100+ new ResponseOptions ( { type : ResponseTypes . Error } ) ) ;
101+ ObservableWrapper . subscribe < Response > ( connection . response , res => {
102+ expect ( res . type ) . toBe ( ResponseTypes . Error ) ;
103+ } , null , ( ) => { async . done ( ) ; } ) ;
104+
105+ existingXHRs [ 0 ] . dispatchEvent ( 'load' ) ;
106+ } ) ) ;
107+
98108 it ( 'should call abort when disposed' , ( ) => {
99109 var connection = new XHRConnection ( sampleRequest , new MockBrowserXHR ( ) ) ;
100110 connection . dispose ( ) ;
You can’t perform that action at this time.
0 commit comments