Closed mmindenhall closed 9 years ago
Thank you for sharing this.
The Content function is indeed a bit confusing here. The current way to pass in a JSON as is, is to set the BodyReader field of the config. This, however, is quite different from the function api.
I propose to change this function (Content) such that is works as expected from your example. In addition, I will implement an extra validation to verify that the content is correct JSON (or XML if passed "application/xml").
for now, I leave out the validation part until someone requests for it.
Hello, The
RequestConfig.Content
method does not detect when thepayload
param is already a JSON string, and therefore does not need to be marshaled. For example:See example in go playground.