initial commit

This commit is contained in:
Gardient
2018-06-07 22:50:47 +03:00
commit 926aeb4eee
7 changed files with 252 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
package utils
import (
"encoding/json"
"io/ioutil"
"net/http"
)
// UnmarshalFromResponse will unmarshal json from response body
func UnmarshalFromResponse(response *http.Response, v interface{}) {
responseBody, err := ioutil.ReadAll(response.Body)
PanicOnError(err)
err = json.Unmarshal(responseBody, &v)
PanicOnError(err)
}