question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

statusCodesToRetry doesn't work when Http Status Code is 2xx

See original GitHub issue

When specify statusCodesToRetry as 2xx, this doesn’t work because of the following code:

export function attach(instance?: AxiosInstance) {
  instance = instance || axios;
  return instance.interceptors.response.use(onFulfilled, onError);
}

onError will be only triggered when the Http Status Code is not 2xx. That means all retries this library will perform only works when Http Status Code is not 2xx.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
JustinBeckwithcommented, Jan 19, 2020

So to be honest - this is far enough outside the goal of the library, that I don’t want to add support for managing retries on 2xx responses. The interceptor API in axios is good enough that you should be able to plug in there, and lift whatever bits of backoff stuff you need from here. Apologies!

1reaction
shubhamdcommented, Apr 30, 2019

One of the ways we can implement this by not actually implementing this is - In axios-retry, we start catching the errors thrown by custom interceptors (request/response) of axios. In this way people can write their own custom interceptors and validate the data the way they want. @JustinBeckwith, Thoughts?

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP response status codes - MDN Web Docs - Mozilla
HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes:
Read more >
List of HTTP status codes - Wikipedia
This is a list of Hypertext Transfer Protocol (HTTP) response status codes. Status codes are issued by a server in response to a...
Read more >
java - Is checking "http_status / 100 != 2" better than ...
So if you want to handle the condition if the status code is NOT belonging to 2xx, you can do the below: if...
Read more >
HTTP Status Codes: All 63 explained - including FAQ & Video
HTTP status codes are three-digit responses from the server to the browser-side request. Everyone has probably gotten the classic 404 page-not-found error.
Read more >
Status codes in HTTP - W3C
The data sections of messages Error, Forward and redirection responses may be used to contain human-readable diagnostic information. Success 2xx. These codes ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found