Minor changes

This commit is contained in:
Alexander Sheiko 2022-04-09 20:00:09 +03:00
parent 41d7f514e3
commit 7c236e105c

7
api.go
View file

@ -72,14 +72,13 @@ func (s *Scraper) GetGuestToken() error {
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
content, _ := ioutil.ReadAll(resp.Body)
return fmt.Errorf("response status %s: %s", resp.Status, content)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("response status %s: %s", resp.Status, body)
}
var jsn map[string]interface{}
if err := json.Unmarshal(body, &jsn); err != nil {