Ky: Add `afterResponse` hook

Created on 15 Sep 2018  路  4Comments  路  Source: sindresorhus/ky

hello,

are there any plans to add a afterResponse hook like axios' response interceptor?

thank you for this library!
nicolai

enhancement help wanted

Most helpful comment

Just came here to propose the same feature. I'd also love to see this feature to be able to refresh access tokens on 401 responses.

All 4 comments

Can you share some use-cases for this?

PR welcome :)

  • Automatic logging for HTTPErrors.
  • Similarly, redirecting if the error code is 401 Unauthorized.
  • Response sanitization / escaping

Just a couple use cases that came to mind

Just came here to propose the same feature. I'd also love to see this feature to be able to refresh access tokens on 401 responses.

Was this page helpful?
0 / 5 - 0 ratings