Open JoseSFOc opened 1 month ago
After some tweaking and checking in the codebase, I manage to fix this issue for all the APIs that failed.
The change was made in isahc::HttpClient::create_easy_handle
and it's as follows:
1093 // Setting the post fields to `&[]` fixes the issue with some APIs not accepting
1094 // POST request with undefined body
1095 if !has_body {
1096 easy.post_fields_copy(&[])?;
1097 }
This makes the body empty and not undefined, fixing the rejection of some APIs.
I made this change myself and ran all the tests available in the repo, succeeding in all of them. As I'm not allowed to create a new branch, ergo I cannot create a new PR for this fix. I'll wait for @sagebind to see this issue and offer a solution for this.
Hello!
My team is currently working on a system that has to interact with many different APIs, we migrated from
reqwest
for some issues with the library that were solved byisahc
.We've now encountered a problem where some APIs don't accept a request with an empty body as it would do with no body at all. We're creating the request using the following method:
As the documentation says that
Body::empty()
gives a request with the absence of a body -> Body::empty()But when displaying the log information for the created request we obtain this (obscuring some sensible information):
While
reqwest
generates the following:As in the previous example, using
Body::empty()
is creating a body in the request with length zero, is there any other way to create a request with no body? UsingBody::empty()
should create a empty body instead of no body in the request?Thanks!