Add access to original request object in hook and endpoints
See original GitHub issueIs your feature request related to a problem? Please describe.
Yes, we need to verify some IPs in the endpoints but there is no way to get that in the current state of svelte kit (please correct me if i’m wrong 😃
Describe the solution you’d like
I love that the normal Request
object is parsed by default so that for most of the endpoints/api there is no need to add middleware.
However there might be cases where this is not enough, as for example getting the IP of the connectiong client.
Exposing the raw request as rawRequest
e.g. could be a solution where most edge cases should become solvable. We already have rawBody
.
Describe alternatives you’ve considered
None came to mind.
How important is this feature to you?
Quite important, withouth the ability to get the client IP we can not use kit for the current project unfortunately.
Additional context
Might be related to https://github.com/sveltejs/kit/issues/1610.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
Have you seen hooks? https://kit.svelte.dev/docs#hooks If you want to access raw request, you will need to do something like this https://github.com/sveltejs/kit/issues/887#issuecomment-817327725
For some reason I was expecting it to work in localhost. Dumb mistake xD I tried with a vercel deployment and it works well, thanks for responding 😃