17 lines
299 B
Go
17 lines
299 B
Go
package utils
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
"io/ioutil"
|
|
)
|
|
|
|
// UnmarshalJSON will unmarshal json from response body
|
|
func UnmarshalJSON(reader io.Reader, v interface{}) {
|
|
responseBody, err := ioutil.ReadAll(reader)
|
|
PanicOnError(err)
|
|
|
|
err = json.Unmarshal(responseBody, &v)
|
|
PanicOnError(err)
|
|
}
|