Answer the question
In order to leave comments, you need to log in
How to read the answer?
I'm using http.PostForm .
Trying to read the response without:
read, err := ioutil.ReadAll(response.Body)
if err != nil {
log.Printf("Error ReadAll %#v\n", err)
}
raw, _ := gzip.NewReader(response.Body)
dec := json.NewDecoder(raw) или json.NewDecoder(response.Body)
var v ErrorRes
if err := dec.Decode(&v); err != nil {
}
Answer the question
In order to leave comments, you need to log in
Because http.Response.Body can only be read once. Next, you need to use the read result obtained in the previous step. If, after reading, you need to save the Body value, then you need to manually recreate it. An example can be found here: https://stackoverflow.com/questions/43021058/golan...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question