Poll OpenCode permission requests and forward chat_reply
This commit is contained in:
@@ -262,6 +262,11 @@ func (c *Connection) Native(ctx context.Context, method, path string, body any)
|
||||
evidence, _ := io.ReadAll(io.LimitReader(response.Body, 16<<10))
|
||||
return evidence, fmt.Errorf("OpenCode %s %s failed (HTTP %d)", method, path, response.StatusCode)
|
||||
}
|
||||
// A successful no-content operation (the permission-reply endpoint returns
|
||||
// 204) carries no JSON body to validate.
|
||||
if response.StatusCode == http.StatusNoContent {
|
||||
return nil, nil
|
||||
}
|
||||
if !strings.HasPrefix(response.Header.Get("Content-Type"), "application/json") {
|
||||
return nil, fmt.Errorf("OpenCode %s %s returned a non-JSON API response", method, path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user