Response is a type alias for a record representing the response, with the types of the body field of the response parametrized. In other words, Response theTypeOfBody is a convenient name for the shape of any record with this shape:
{ url : String
, status : { code : Int, message : String }
, headers : Dict String String
, body : theTypeOfBody
}
So Response String means you’re dealing with a record that has exactly the above shape, with the type of the body field set to String:
{ url : String
, status : { code : Int, message : String }
, headers : Dict String String
, body : String
}
When you’re dealing with a BadPayload error, this means that the body does not match what was expected. Most often, this means that a JSON decoder failed to decode it. In that case, having the Response record with the body as a plain String means you can log the exact string-value that your decoder failed to decode.