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

Cloning Request so that it can be used for retry fetch #70

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

mahidhar4
Copy link

Cloning request object and sending back in response or error of fetch so that it can be used for retry logic with request. Using existing request object for retry throws an error as body is already read and used so cloning it

Cloning request object and sending back in response or error of fetch so that it can be used for retry logic with request.
Using existing request object for retry throws an error as body is already read and used so cloning it
@@ -19,11 +19,14 @@ function interceptor(fetch, ...args) {
// Register fetch call
promise = promise.then(args => {
const request = new Request(...args);
const cloneRequest = request.clone();
return fetch(request).then(response => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Adding this cloneRequest is not super cool let's do the following change at least

Suggested change
return fetch(request).then(response => {
return fetch(request.clone()).then(response => {

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

Successfully merging this pull request may close these issues.

1 participant