You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@jeevatkm I was implementing one client and the server is probably with issue in one of the routes that sends 201 and body is empty but r.body is getting initialized somehow although its length is 0. Maybe empty string is coming from server.
It also affects SetResult(), maybe a check in parseResponseBody is also needed to prevent error from unmarshalling empty []byte{}
if we change from:
func (r *Response) fmtBodyString(sl int64) string {
if r.body != nil {
if int64(len(r.body)) > sl {
...
Actual: Here we can see there's nothing in body, maybe empty string? but Content-Type is application/json; charset=utf-8
resty v2.7.0
go 1.20
@jeevatkm I was implementing one client and the server is probably with issue in one of the routes that sends 201 and body is empty but r.body is getting initialized somehow although its length is 0. Maybe empty string is coming from server.
It also affects
SetResult()
, maybe a check inparseResponseBody
is also needed to prevent error from unmarshalling empty[]byte{}
if we change from:
Actual: Here we can see there's nothing in body, maybe empty string? but Content-Type is application/json; charset=utf-8
to:
After this small change everything is fine now:
The text was updated successfully, but these errors were encountered: