-
Notifications
You must be signed in to change notification settings - Fork 23
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
use axios instead of got for sending request #179
Comments
Finally, I found a way to make this work with got, by passing this option allowGetBody.
I am keeping this issue open, to let you decide guys if that's still worth keeping in mind as an option. |
The decision for got was deliberate. My POC had still used axios. The main reason was that got also supports HTTP/2 and I wanted to be as close as possible to the actual browser call. But I left it open to implement a axios plugin on your own. You would just to implement httpClientProvider which wraps all calls to got. But I didn't implement the interface cleanly, because in some places I still use the Got Request Options myself (like in digestVariableProvider). I did not know the setting and I add it. Even if I would rather not use it myself on the server side. |
https://github.com/sindresorhus/got/blob/main/documentation/2-options.md#allowgetbody
Doesn't sound like GET requests were designed to do this... |
@Kaarel I agree with you that it is not part of the specification, and for that reason I will not use it myself in any way. It is not worth the trouble. However, it shouldn't be a problem to allow it in for use in httpyac. Or do you know constellations where this can become a problem ? |
Nah, just noticed this thread and started wondering about bodies with GET requests :) |
@Kaarel, in fact in the front side, it is much easier to work with a get request when handling a request like a search, principally for caching, and on the back side I am much more comfortable with a get since the request is not changing any database or server state, last time I honestly searched some hours on this topic, and I can say that the number of people not seeing any problem with using a body in get is increasing with years, there will be some old servers that will ignore the body on gets, but the risk is still small. |
@Gxmadix I fully agree with your arguments. I am just a lame duck. I fear that a firewall, Ingress or reverse proxy will remove my body. I have never tried it though. But maybe this would be a topic to bring up in my environment. I know the problem only too well. |
Is it possible to use httpyac, with another library than got, got does not support body on get requests, but axios does.
This make these kinds of requests impossible to perform, it is not a good choice to pass the data in query params neither it is to make it a post request, a QUERY method is in study, but we are not there yet, so in the meantime a good workaround is to keep using libraries that support body with get method.
request
Error message:
RequestError: The
GETmethod cannot be used with a body at Gk._destroy
The text was updated successfully, but these errors were encountered: