mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-18 20:23: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,8 @@
|
||||
package jira
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
|
||||
)
|
||||
|
||||
@@ -18,7 +20,7 @@ func GetFields(ua HttpClient, endpoint string) ([]jiradata.Field, error) {
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode == 200 {
|
||||
results := []jiradata.Field{}
|
||||
return results, readJSON(resp.Body, &results)
|
||||
return results, json.NewDecoder(resp.Body).Decode(&results)
|
||||
}
|
||||
return nil, responseError(resp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user