return
}
- _, _ = w.Write(data)
+ // The client can cancel a media request before this reply is
+ // written.
+ w.Write(data) // nolint: errcheck
return
}
wait = 1
}
- _, _ = fmt.Fprintf(w, `{"ok":false,"error_code":%d,"description":%q,"parameters":{"retry_after":%d}}`, status, description, wait)
+ // A test can cancel the request after the handler selects its
+ // reply.
+ fmt.Fprintf(w, `{"ok":false,"error_code":%d,"description":%q,"parameters":{"retry_after":%d}}`, status, description, wait) // nolint: errcheck
return
}
f.record(call)
if method == "getFile" {
- _ = json.NewEncoder(w).Encode(map[string]any{
+ // A cancelled client does not need a response body.
+ json.NewEncoder(w).Encode(map[string]any{ // nolint: errcheck
"ok": true,
"result": map[string]any{"file_path": params["file_id"]},
})
}
if method != "getUpdates" {
- _, _ = io.WriteString(w, `{"ok":true,"result":true}`)
+ // A cancelled client does not need a response body.
+ io.WriteString(w, `{"ok":true,"result":true}`) // nolint: errcheck
+
return
}
updates = f.from(offset)
}
- _ = json.NewEncoder(w).Encode(map[string]any{
+ // A cancelled client does not need a response body.
+ json.NewEncoder(w).Encode(map[string]any{ // nolint: errcheck
"ok": true,
"result": updates,
})