[REQ] swift5 Response type should also contain raw response data
Created by: Jonas1893
Is your feature request related to a problem? Please describe.
Current Response
type has a body
property containing the decoded value of the response data. There are cases where it would be valuable to have access to the (not yet decoded) raw response data, e.g. when logging where we also want to log the raw JSON output.
Describe the solution you'd like
Response
type should be enhanced by a new property carrying the raw response data. Current naming of body
property is imo misleading as it is the already decoded representation of the response body. I suggest to rename it to decodedResponse
and use body
for the raw response data. Since this is breaking current API we could also alternatively just use bodyData
for the new property name.
Describe alternatives you've considered
It is not possible with reasonable effort to infer raw data from already decoded response as decoder might contain custom logic and there is no guarantee we always have the correct inverse encoder present. Therefor we need the raw data passed in the Response
object