Closed jensencelestial closed 4 years ago
Nice catch! To be honest I completely missed this, you are right, it shouldn't be like that. This is easily fixed by either changing _sendUnstreamed
to have named parameters or by creating a separate _sendUnstreamed
for the get HTTP Method. Feel free to drop a PR if you can, otherwise I'll fix it as soon as I can.
Thanks!
Thank you for the quick reply. I'll try to make a PR, will it be alright to just insert a null parameter to these methods, since that is what you did with the head
and delete
methods.
Future<Response> post(url,
{Map<String, String> headers, body, Encoding encoding}) =>
_sendUnstreamed("POST", url, headers, null, body, encoding);
To be honest I would like it to be like the _sendInterception
method in http_with_interceptor.dart
. I think I'll have a couple of hours available later during the day to fix it and release a hotfix. But if it works for you that's fine for now.
Upon taking a look at _sendInterception
, it really looks like the better approach. I'll wait for the hotfix release, but I'll try to use the null approach in my fork in the meantime. Thank you very much! 😄
Cool, and sure, anytime! 👍
Done! The new version 0.1.1 should fix the issue.
Hi, I have noticed that for Http methods that doesn't need query parameters (POST, PUT, PATCH, etc.), the body parameter is being assigned to params in
_sendUnstreamed
function instead. Refer to the example below:For the post function above, the body parameter is being passed to params, causing type mismatch exceptions when being used.
This is the
_sendUnstreamed
function for reference: