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

Discord proxy and more gradual request control #548

Open
WinteryFox opened this issue Mar 2, 2022 · 0 comments
Open

Discord proxy and more gradual request control #548

WinteryFox opened this issue Mar 2, 2022 · 0 comments

Comments

@WinteryFox
Copy link
Contributor

Hi friendly Kord contributors,

I would like to use a proxy between my Kord rest instance and the Discord rest endpoints, this proxy will be handling rate limits as well. I've noticed that there is currently no no-op rate limit handler either. In my quest to use a proxy I decided to "implement" my own RequestHandler, to do this I was going to copy the current default RequestHandler implementation and modify it to fit my needs, make it use another URL than the Discord base URL as well as add headers per request basis (requests will need to send a token that will vary through the lifetime of the application in the headers, as well as some other headers I need to add.) Upon attempting this however I discovered another issue with this method, in that the optional serializer for the KtorRequestException class is marked as internal (

internal val <T> DeserializationStrategy<T>.optional: ResponseMapper<T?>
), and thus cannot be used by any custom implementations of the RequestHandler, even if they also use ktor.

Here's an outline of the things I'd like to see added/changed

  • Add support for proxies
  • Add some way to change the Request before it's actually executed in whatever RequestHandler (e.g. adding/changing headers)
  • Mark the optional serializer as public for KtorRequestException to allow other RequestHandler implementations that also make use of ktor to use this already existing model.

Cheers,
Amy.

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

No branches or pull requests

1 participant