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

Request as fetch param #15

Open
romanfazulianov opened this issue Apr 20, 2019 · 3 comments
Open

Request as fetch param #15

romanfazulianov opened this issue Apr 20, 2019 · 3 comments

Comments

@romanfazulianov
Copy link

Hello, @starlight36

I'm looking forward for feature that supported by fetch, but as i see from source it is not possible with your library for now. I need to use previous Request instance with method fetch (retrying requests that was rejected by server in cases of status 502, for example)

https://developer.mozilla.org/en-US/docs/Web/API/Request#Examples

Please, say, do you see any way to do it using your library?

@yedaodao
Copy link
Collaborator

I think that you need an interceptor for retrying supported in our library ?

@yedaodao
Copy link
Collaborator

@romanfazulianov Hi, we can add a feature for retrying. Maybe,you only need some examples for writing interceptor ?

@romanfazulianov
Copy link
Author

Hi! I figured out how to write an interceptor with desired behaivour, but as for me it's awkward.

I added callback retry into options param, and then in request interceptor i store it in a variable, delete its link from options and after that in response interceptor if (in my case) status of response is one of 502, 503, 504 - i push it to the queue. Than, after 10 seconds of waiting, i will retry all callbacks that stored in queue.

Retrying implemented with internals of your library should be helpful. I think it would be wounderful to configure retry timeout on new client instance creation and don't call response callback in then method when it has statuses from the defined list.

But if you have another opinion or suggestion, please let me know

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

No branches or pull requests

3 participants