rpip / paystack-go

Go library for the Paystack API https://developers.paystack.co/v1.0/reference
MIT License
62 stars 39 forks source link

APIError.Details empty for error responses #8

Open kayslay opened 3 years ago

kayslay commented 3 years ago

APIError.Details was empty because the ioutil.ReadAll was reading an empty http.Response.Body.

The body of the response was read earlier by the decodeResponse func before attempting to read it again in newAPIError.

Changed the signature of decodeResponse to accept a []byte as the second argument.

Example commit. Check changes made to paystack.go and error.go