mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(coderd): fix parsing of response format in tasks send (#19960)
This commit is contained in:
+1
-1
@@ -675,7 +675,7 @@ func (api *API) taskSend(rw http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
}
|
||||
|
||||
if v, ok := respBody["status"].(string); !ok || v != "ok" {
|
||||
if v, ok := respBody["ok"].(bool); !ok || !v {
|
||||
return httperror.NewResponseError(http.StatusBadGateway, codersdk.Response{
|
||||
Message: "Task app rejected the message.",
|
||||
Detail: fmt.Sprintf("Upstream response: %v", respBody),
|
||||
|
||||
@@ -449,7 +449,7 @@ func TestTasks(t *testing.T) {
|
||||
assert.Equal(t, `{"content":"Hello, Agent!","type":"user"}`, string(b), "expected message content")
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
io.WriteString(w, `{"status": "ok"}`)
|
||||
io.WriteString(w, `{"ok": true}`)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
|
||||
Reference in New Issue
Block a user