MrRefactoring / jira.js

A JavaScript/TypeScript wrapper for the JIRA Cloud, Service Desk and Agile REST API
https://mrrefactoring.github.io/jira.js/
MIT License
349 stars 46 forks source link

Expose rate limiting response headers #299

Closed chalenge closed 1 month ago

chalenge commented 5 months ago

This is related to #277.

The new error handling suppresses response headers useful for handling retry logic for rate-limiting and transient server errors.

From the Jira docs the Jira API exposes some headers Retry-After, X-RateLimit-Reset and X-RateLimit-NearLimit headers which can be used for error retry handling logic and since these are axios errors will always suppress those headers and doesn't seem to be a way to override what errors it returns in the client

I know the original intention was to avoid having axios errors exposing headers and other information that could cause leaks. Can we maybe expose these as an exception or maybe provide a way to config specific headers the user wants to be returned in the errors. Not sure what other headers may be useful for other error handling logic.