nuxt / http

Universal HTTP Module for Nuxt.js
https://http.nuxtjs.org
MIT License
229 stars 51 forks source link

feat: enable advanced retry option #80

Closed nijitaro closed 4 years ago

nijitaro commented 4 years ago

(sorry for my poor english)

for example: API will returns 401 Unauthorized when token expires https://www.rfc-editor.org/rfc/rfc6750#section-3

but ky does not retry 401 by default https://github.com/sindresorhus/ky/blob/c5821a7fbf1af21f934ee5ed5a76fb224559c530/index.js#L119-L127

will be able to advanced specification like: https://github.com/sindresorhus/ky/blob/c5821a7fbf1af21f934ee5ed5a76fb224559c530/index.js#L175-L180

nuxt.config.js

export default {
  ...
  http: {
    retry: {
      limit: 2,
      statusCodes: [401], 
    }
  }
  ...
}