Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpInterceptorService Subscriber.complete() is not called #87

Closed
debben opened this issue Sep 19, 2016 · 2 comments
Closed

HttpInterceptorService Subscriber.complete() is not called #87

debben opened this issue Sep 19, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@debben
Copy link

debben commented Sep 19, 2016

Bug Report

When using HttpInterceptorService in place of Http, the complete callback is not being fired for the returned observables.

Screenshots or link to CodePen/Plunker/JSfiddle

Example:

let http: HttpInterceptorService;

public getDataPromise() : Promise<any> {
    let promise = this.http.get('/some/url').toPromise();
    return promise.then((data) => {
       console.log('this function will never be called');
    },
    (error) => { 
      console.log('this will be called if there was an error');
    });
}

The promise will never have its resolve method called because toPromise returns a promise that only resolves once the observable is complete.

What is the expected behavior?

The completecallback should be called. Many methods call subscribeand provide a callback for complete.

Which version of Angular and Material, and which browser and OS does this issue affect?

All browsers/versions.

Other information

In lines 52-62 of http-interceptor.service.ts you can see where the nextand errormethods are called for subscriber, but complete is never hooked up.

@emoralesb05
Copy link
Contributor

Hey @debben,
Good catch, I totally forgot about complete callback.

Will add this issue for 0.8.0 milestone.

@emoralesb05 emoralesb05 added this to the Alpha 0.8 milestone Sep 19, 2016
@emoralesb05 emoralesb05 self-assigned this Sep 19, 2016
@emoralesb05
Copy link
Contributor

Fixed in #88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants