Closed sooluh closed 2 years ago
Hi @sooluh that's a great suggestion for discussions. I've enabled it here https://github.com/pbojinov/request-ip/discussions
As far as AdonisJS, I haven't personally tested used this web framework but I assume it should work as long as it supports one of the methods described here – https://github.com/pbojinov/request-ip#how-it-works
Hi @pbojinov, thanks for the response.
About this question, I've tried it in AdonisJS, and yes it works, but it's not enough to pass the request argument from AdonisJS to the getClientIp()
method.
Because in AdonisJS, the http context received from the request object is a method-based object, so we have to change it first to JSON, fortunately in AdonisJS itself has a toJSON()
method in the request object, so at least it's easier.
We need to pass request.toJSON()
to the getClientIp()
method, because after I review the code of this module, it uses request.headers
(not a method), but in AdonisJS to get headers, we need to use request.headers()
method, or for values from the header specifically, we use request.header('key')
.
Thanks, I will close this issue.
Hello, I have a question, and my suggestion, maybe the owner should enable the Discussion feature in this repository for questions like this, thanks.