sling v1.0.0 Release Notes
-
- โ Added support for receiving and decoding error JSON structs
- ๐ Renamed Sling
JsonBody
setter toBodyJSON
(breaking) - ๐ Renamed Sling
BodyStruct
setter toBodyForm
(breaking) - ๐ Renamed Sling fields
httpClient
,method
,rawURL
, andheader
to be internal (breaking) - ๐ Changed
Do
andReceive
to skip response JSON decoding if "application/json" Content-Type is missing - ๐ Changed
Sling.Receive(v interface{})
toSling.Receive(successV, failureV interface{})
(breaking)- Previously
Receive
attempted to decode the response Body in all cases - Updated
Receive
will decode the response Body into successV for 2XX responses or decode the Body into failureV for other status codes. Pass a nilsuccessV
orfailureV
to skip JSON decoding into that value. - To upgrade, pass nil for the
failureV
argument or consider defining a JSON tagged struct appropriate for the API endpoint. (e.g.s.Receive(&issue, nil)
,s.Receive(&issue, &githubError)
) - To retain the old behavior, duplicate the first argument (e.g. s.Receive(&tweet, &tweet))
- Previously
- ๐ Changed
Sling.Do(http.Request, v interface{})
toSling.Do(http.Request, successV, failureV interface{})
(breaking)- See the changelog entry about
Receive
, the upgrade path is the same.
- See the changelog entry about
- โ Removed HEAD, GET, POST, PUT, PATCH, DELETE constants, no reason to export them (breaking)