OpenAPI Generator creates API functions that follow the general pattern:
func (api *MyAPI) OperationId(context.Context) (ResponseStruct, *http.Response, error)
How can I retrieve the HTTP body on an error? When the HTTP Status Code is an error, error
is not nil
, however, it does not include the body and neither does *http.Response
as the body has been read already. And, the error is not unmarshaled into the ResponseStruct as the success and failure definitions. are different.