MCPcopy Create free account
hub / github.com/compozy/agh / decodeJSONResponse

Method decodeJSONResponse

internal/cli/client.go:5374–5391  ·  view source on GitHub ↗
(
	_ context.Context,
	method string,
	path string,
	response *http.Response,
	responseBody any,
)

Source from the content-addressed store, hash-verified

5372}
5373
5374func (c *unixSocketClient) decodeJSONResponse(
5375 _ context.Context,
5376 method string,
5377 path string,
5378 response *http.Response,
5379 responseBody any,
5380) error {
5381 if response.StatusCode < 200 || response.StatusCode >= 300 {
5382 return readAPIError(response)
5383 }
5384 if responseBody == nil {
5385 return drainResponseBody(method, path, response.Body)
5386 }
5387 if err := json.NewDecoder(response.Body).Decode(responseBody); err != nil {
5388 return fmt.Errorf("cli: decode %s %s response: %w", method, path, err)
5389 }
5390 return nil
5391}
5392
5393func (c *unixSocketClient) doSSE(
5394 ctx context.Context,

Callers 2

doJSONMethod · 0.95
doAgentJSONMethod · 0.95

Calls 2

readAPIErrorFunction · 0.85
drainResponseBodyFunction · 0.85

Tested by

no test coverage detected