react-polling
react-polling copied to clipboard
Polling empty responses?
https://github.com/vivek12345/react-polling/blob/6a807c2b535aace01b342c7ee627c8f61d970c4e/src/ReactPolling.js#L127
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()
?
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.
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.
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 });
}
}