Skip to content

Commit

Permalink
default unmarshal to json if Content-Type is not sure(#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Apr 14, 2022
1 parent 37c4693 commit f51cc13
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ func unmarshalBody(c *Client, r *Response, v interface{}) (err error) {
return c.jsonUnmarshal(body, v)
} else if util.IsXMLType(ct) {
return c.xmlUnmarshal(body, v)
} else {
c.log.Warnf("cannot determine the unmarshal function with %q Content-Type, default to json", ct)
return c.jsonUnmarshal(body, v)
}
return
}
Expand Down

0 comments on commit f51cc13

Please sign in to comment.