PUT requests will not send a json payload regardless of content type
When I use http.put() and supply a JSON encoded string as the body or a utf8 encoded series of bytes representing the same string as the bodyBytes, the body will not be sent with the request regardless of me specifying the content type as either
final headers = <String, String>{
'Content-Type': 'application/json',
};
or
final headers = <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
};
The content type will be there, but the body is just not sent. The exact same body and headers will send the body when using http.post.
My question is: Is this intended behavior?
The server I am communicating with is under my control so I can change the method(will not do that as I am obviously PUTting data in this use case), and I can also switch it to use x-www-url-encoded (my temporary workaround), but there is no standards-based reason for JSON not to be sent with a PUT.
If additional context is needed, I am happy to help out some old friends, and please tell me if there is something I'm missing or getting wrong. :-)
Hi @gamebox
Could you provide a complete code example that demonstrates the broken behavior?
Closing as stale as no reproduction was provided.