mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-19 04:33:28 +02:00
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:
@@ -1,6 +1,7 @@
|
||||
package jira
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
@@ -8,7 +9,7 @@ import (
|
||||
|
||||
func responseError(resp *http.Response) error {
|
||||
results := &jiradata.ErrorCollection{}
|
||||
if err := readJSON(resp.Body, results); err != nil {
|
||||
if err := json.NewDecoder(resp.Body).Decode(results); err != nil {
|
||||
results.Status = resp.StatusCode
|
||||
results.ErrorMessages = append(results.ErrorMessages, err.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user