Skip to content

Commit f52a6e2

Browse files
authored
Merge pull request #355 from Dkamps18/apierrordataarray
Don't make data object an empty array on error
2 parents cb0a5b1 + 62c8d47 commit f52a6e2

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

internal/api/api.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ func NewRequest(method string, path string, queryParameters []string, body []byt
4545

4646
isExtensionsLiveEndpoint := false // https://github.com/twitchdev/twitch-cli/issues/157
4747

48-
data.Data = make([]interface{}, 0)
4948
client, err := GetClientInformation()
5049
if err != nil {
5150
return fmt.Errorf("Error fetching client information: %v", err.Error())
@@ -186,7 +185,7 @@ func NewRequest(method string, path string, queryParameters []string, body []byt
186185
runCounter++
187186
}
188187

189-
if data.Data == nil {
188+
if data.Data == nil && data.Error == "" {
190189
data.Data = make([]interface{}, 0)
191190
}
192191
// handle json marshalling better; returns empty slice vs. null

0 commit comments

Comments
 (0)