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

Need to access Response Headers through RequestFailedException #221

Open
rknikode opened this issue Apr 3, 2024 · 1 comment
Open

Need to access Response Headers through RequestFailedException #221

rknikode opened this issue Apr 3, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@rknikode
Copy link

rknikode commented Apr 3, 2024

Is your feature request related to a problem? Please describe.
When performing email account authorization with Nylas, if the request fails due to hitting the rate limit (status code 429), Nylas suggests implementing an exponential backoff strategy. However, the RequestFailedException thrown by Nylas does not provide access to the response headers, which contain valuable information such as the rate limit and reset time.

Describe the solution you'd like

  1. Modify the executeRequest method in the NylasClient class to capture and return the response headers along with the response body.
  2. Enhance the RequestFailedException class to include a field for storing the response headers.
  3. Pass the response headers to the RequestFailedException.parseErrorResponse method when creating a new instance of RequestFailedException.
  4. Provide getter methods in the RequestFailedException class to retrieve the response headers.
  5. Then we can utilize the response headers in the application code to implement the exponential backoff strategy based on the rate limit and reset time provided by Nylas.
@rknikode rknikode added the enhancement New feature or request label Apr 3, 2024
@mrashed-dev mrashed-dev self-assigned this May 31, 2024
@mrashed-dev
Copy link
Collaborator

Thanks for opening this issue @rknikode, we will look into this and see if we can put these improvements on a roadmap. We will reply here when we have an update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants