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

Function mockQueryResponse

tools/querytee/proxy_test.go:340–354  ·  view source on GitHub ↗
(path string, status int, res string)

Source from the content-addressed store, hash-verified

338}
339
340func mockQueryResponse(path string, status int, res string) http.HandlerFunc {
341 return func(w http.ResponseWriter, r *http.Request) {
342 // Ensure the path is the expected one.
343 if r.URL.Path != path {
344 w.WriteHeader(http.StatusNotFound)
345 return
346 }
347
348 // Send back the mocked response.
349 w.WriteHeader(status)
350 if status == http.StatusOK {
351 _, _ = w.Write([]byte(res))
352 }
353 }
354}

Callers 2

TestProxy_PassthroughFunction · 0.85

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected