Merge pull request #1093 from cli/api-file
gh api: fix passing file/stdin contents via field arguments
This commit is contained in:
commit
24ca449179
2 changed files with 7 additions and 1 deletions
|
|
@ -22,6 +22,12 @@ func httpRequest(client *http.Client, method string, p string, params interface{
|
|||
if strings.EqualFold(method, "GET") {
|
||||
url = addQuery(url, pp)
|
||||
} else {
|
||||
for key, value := range pp {
|
||||
switch vv := value.(type) {
|
||||
case []byte:
|
||||
pp[key] = string(vv)
|
||||
}
|
||||
}
|
||||
if isGraphQL {
|
||||
pp = groupGraphQLVariables(pp)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ func Test_httpRequest(t *testing.T) {
|
|||
method: "POST",
|
||||
p: "graphql",
|
||||
params: map[string]interface{}{
|
||||
"a": "b",
|
||||
"a": []byte("b"),
|
||||
},
|
||||
headers: []string{},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue