mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
fix: address verified review findings (api-transport-download-1)
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
11 files changed
+192
-11
No files matched your search
+4
-1
@@ -303,6 +303,9 @@ func (o apiResponse) write(w io.Writer, r *http.Response) error {
|
||||
return err
|
||||
}
|
||||
if o.query != "" && succeeded {
|
||||
if len(data) == 0 {
|
||||
return nil
|
||||
}
|
||||
if !json.Valid(data) {
|
||||
return fmt.Errorf("--jq needs a JSON response, but the response is %s", cmp.Or(mediaType, "not JSON"))
|
||||
}
|
||||
@@ -363,7 +366,7 @@ func writeRequestHead(w io.Writer, r *http.Request) error {
|
||||
|
||||
func writeHead(w io.Writer, prefix, first string, headers http.Header) error {
|
||||
var b strings.Builder
|
||||
b.WriteString(prefix + first + "\n")
|
||||
b.WriteString(prefix + terminal.SafeLine(first) + "\n")
|
||||
for _, key := range slices.Sorted(maps.Keys(headers)) {
|
||||
for _, value := range headers.Values(key) {
|
||||
b.WriteString(prefix + terminal.SafeLine(key+": "+value) + "\n")
|
||||
|
||||
Reference in new issue
Block a user