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

Allow override of headers applied by default #2529

Merged
merged 1 commit into from
Sep 23, 2023

Conversation

zaroxh
Copy link
Contributor

@zaroxh zaroxh commented Aug 31, 2023

Pull Request Etiquette

Changes

  • Internal code
  • Library interface (affecting end-user code)
  • Documentation
  • Other: _____

Closes Issue: NaN

Description

Changed the applyHeaders method in the Requester class, so that custom headers with the same name in custom requests override the headers applied by default. This is useful if you want to override the "Authorization" header for example in a custom OAuth2 request, that needs another value for this header. The previous behaviour in this case caused there to be two "Authorization" headers in the request, which in turn lead to a HTTP 400 error being returned by the Discord API.

@MinnDevelopment
Copy link
Member

I would not recommend using JDA for OAuth requests like this, because JDA will treat all requests to be in the same rate-limit system. OAuth requests generally have different rate-limits applied per auth token, which the internal requester is not equipped to handle.

@MinnDevelopment MinnDevelopment merged commit ef35fc5 into discord-jda:master Sep 23, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants