don't use ReadAll when decoding JSON

An empty stream isn't valid JSON, so we shouldn't silently ignore it.
This commit is contained in:
Daniel Martí
2019-05-27 11:02:50 +01:00
parent 098d963881
commit 9bcdcc128f
11 changed files with 29 additions and 53 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ func CreateComponent(ua HttpClient, endpoint string, cp ComponentProvider) (*jir
if resp.StatusCode == 201 {
results := &jiradata.Component{}
return results, readJSON(resp.Body, results)
return results, json.NewDecoder(resp.Body).Decode(results)
}
return nil, responseError(resp)
}