MCPcopy Index your code
hub / github.com/cortexproject/cortex / doBackendRequest

Method doBackendRequest

tools/querytee/proxy_backend.go:100–119  ·  view source on GitHub ↗
(req *http.Request)

Source from the content-addressed store, hash-verified

98}
99
100func (b *ProxyBackend) doBackendRequest(req *http.Request) (int, []byte, error) {
101 // Honor the read timeout.
102 ctx, cancel := context.WithTimeout(context.Background(), b.timeout)
103 defer cancel()
104
105 // Execute the request.
106 res, err := b.client.Do(req.WithContext(ctx))
107 if err != nil {
108 return 0, nil, errors.Wrap(err, "executing backend request")
109 }
110
111 // Read the entire response body.
112 defer res.Body.Close()
113 body, err := io.ReadAll(res.Body)
114 if err != nil {
115 return 0, nil, errors.Wrap(err, "reading backend response")
116 }
117
118 return res.StatusCode, body, nil
119}

Callers 1

ForwardRequestMethod · 0.95

Calls 3

DoMethod · 0.65
WrapMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected