Commit graph

9 commits

Author SHA1 Message Date
Mislav Marohnić
62549465a0 Display JSON in indented, colored format in api output 2020-06-05 17:43:07 +02:00
Mislav Marohnić
7033021637 gh api: fix passing file/stdin contents via field arguments
Reading from file via `-F foo=@myfile.txt` syntax would result in
`[]byte` Go type, which by default gets serialized to JSON in base64
format, which we don't want here.

Traverse all parameters and convert any `[]byte` into `string` before
JSON serialization.
2020-06-03 16:00:52 +02:00
Mislav Marohnić
ea3a55c3d6 Ensure that cobra command tests don't write to system stdout/stderr 2020-05-20 16:28:35 +02:00
Mislav Marohnić
292b428465 Add test for showing response headers 2020-05-20 16:28:27 +02:00
Mislav Marohnić
bef62faaea Make NewCmdApi testable 2020-05-20 15:21:35 +02:00
Mislav Marohnić
f58e0bf710 Add api tests 2020-05-20 15:21:32 +02:00
Mislav Marohnić
a7100b1fdd Extract parseFields to a func 2020-05-20 15:21:31 +02:00
Mislav Marohnić
7ffbde3e12 Allow setting multiple values for a request header 2020-05-20 15:21:31 +02:00
Mislav Marohnić
90fa193eaf Promote api command to a pkg/cmd/api package 2020-05-20 15:21:31 +02:00