(requestSummary string, resp *http.Response)
| 1958 | } |
| 1959 | |
| 1960 | func (c *streamableClientConn) handleJSON(requestSummary string, resp *http.Response) { |
| 1961 | body, err := io.ReadAll(resp.Body) |
| 1962 | resp.Body.Close() |
| 1963 | if err != nil { |
| 1964 | c.fail(fmt.Errorf("%s: failed to read body: %v", requestSummary, err)) |
| 1965 | return |
| 1966 | } |
| 1967 | msg, err := jsonrpc.DecodeMessage(body) |
| 1968 | if err != nil { |
| 1969 | c.fail(fmt.Errorf("%s: failed to decode response: %v", requestSummary, err)) |
| 1970 | return |
| 1971 | } |
| 1972 | select { |
| 1973 | case c.incoming <- msg: |
| 1974 | case <-c.done: |
| 1975 | // The connection was closed by the client; exit gracefully. |
| 1976 | } |
| 1977 | } |
| 1978 | |
| 1979 | // handleSSE manages the lifecycle of an SSE connection. It can be either |
| 1980 | // persistent (for the main GET listener) or temporary (for a POST response). |
no test coverage detected