unmarshalTo unmarshals an HTTP response body to a given interface.
(r *http.Response, v interface{})
| 139 | |
| 140 | // unmarshalTo unmarshals an HTTP response body to a given interface. |
| 141 | func unmarshalTo(r *http.Response, v interface{}) error { |
| 142 | defer r.Body.Close() |
| 143 | return json.NewDecoder(r.Body).Decode(v) |
| 144 | } |
| 145 | |
| 146 | // Create creates a new Crawler. |
| 147 | // It returns the Crawler ID if successful. |