DecodeJSON decodes the JSON in res.Body into dest and then closes res.Body.
(res *http.Response, dest interface{})
| 271 | // DecodeJSON decodes the JSON in res.Body into dest and then closes |
| 272 | // res.Body. |
| 273 | func DecodeJSON(res *http.Response, dest interface{}) error { |
| 274 | defer res.Body.Close() |
| 275 | if err := json.NewDecoder(res.Body).Decode(dest); err != nil { |
| 276 | return fmt.Errorf("httputil.DecodeJSON: %v", err) |
| 277 | } |
| 278 | return nil |
| 279 | } |
| 280 | |
| 281 | func IsWebsocketUpgrade(req *http.Request) bool { |
| 282 | return req.Method == "GET" && req.Header.Get("Upgrade") == "websocket" |
no test coverage detected