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

Polling empty responses? #13

Open
asgeirn opened this issue Nov 26, 2019 · 3 comments
Open

Polling empty responses? #13

asgeirn opened this issue Nov 26, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@asgeirn
Copy link

asgeirn commented Nov 26, 2019

return resp.json().then(data => {

I'm attempting to use the component for an asynchronous REST service, where the /status endpoint will respond with 202 and an empty response body until the service eventually succeeds.

However, since the response function evaluates Body.json(), I'm suspecting the polling stops on an unhandled error. Perhaps the function should guard with a test for non-empty body before evaluating Body.json()?

@qtcoder999
Copy link

I am also facing this issue, I am receiving plain text response from an API successfully, but the library is considering it as failure. It triggers onFailure after receiving the success response 200.

@vivek12345
Copy link
Owner

Hey @asgeirn and @qtcoder999 , apologies for the delay. The last couple of months have been really hectic in terms of work.
But I am hoping latest release v1.0.7 will address all your concerns.
Thank you for creating this issue and I hope the new release is helpful.

Please try it and let me know if it fixes your issue.

@vivek12345 vivek12345 added the bug Something isn't working label Jun 23, 2020
@vivek12345 vivek12345 self-assigned this Jun 23, 2020
@asgeirn
Copy link
Author

asgeirn commented Sep 9, 2020

Hi,

I've just tested v1.0.8, but unfortunately this didn't work for our case. We've worked around it with a fork where we've added the following :

          if (resp.headers.get('Content-Length') === '0') {
            if (resp.ok) {
              return resp;
            } else {
              return Promise.reject({ status: resp.status, resp });
            }
          }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants