Skip to content

Commit

Permalink
Merge pull request #7 from gojuno/BE-9165
Browse files Browse the repository at this point in the history
fixes #6. add support for golang 1.8.3
  • Loading branch information
vpbarb authored Aug 28, 2017
2 parents 8363a55 + e661eba commit add73fe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"bytes"
"context"
"encoding/json"
"io"
"io/ioutil"
"net/http"

Expand Down Expand Up @@ -104,17 +105,17 @@ func OptEnv(env env) Option {
// Call does HTTP request with given params using set HTTP client. Response will be decoded into respObj.
// Error may be returned if something went wrong. If API return error as response, then Call returns error of type zooz.Error.
func (c *Client) Call(ctx context.Context, method, path string, headers map[string]string, reqObj interface{}, respObj interface{}) (callErr error) {
var reqBody []byte
var err error
var reqBody io.Reader

if reqObj != nil {
reqBody, err = json.Marshal(reqObj)
reqBodyBytes, err := json.Marshal(reqObj)
if err != nil {
return errors.Wrap(err, "failed to marshal request body")
}
reqBody = bytes.NewBuffer(reqBodyBytes)
}

req, err := http.NewRequest(method, apiURL+path, bytes.NewBuffer(reqBody))
req, err := http.NewRequest(method, apiURL+path, reqBody)
if err != nil {
return errors.Wrap(err, "failed to create HTTP request")
}
Expand Down

0 comments on commit add73fe

Please sign in to comment.