MCPcopy Create free account
hub / github.com/zalando/skipper / startTestServer

Function startTestServer

proxy/proxy_test.go:300–321  ·  view source on GitHub ↗
(payload []byte, parts int, check requestCheck)

Source from the content-addressed store, hash-verified

298}
299
300func startTestServer(payload []byte, parts int, check requestCheck) *httptest.Server {
301 return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
302 check(r)
303
304 w.Header().Set("X-Test-Response-Header", "response header value")
305
306 if len(payload) <= 0 {
307 return
308 }
309
310 w.Header().Set("Content-Type", "text/plain")
311 w.Header().Set("Content-Length", strconv.Itoa(len(payload)))
312 w.WriteHeader(http.StatusOK)
313
314 if parts > 0 {
315 writeParts(w, parts, payload)
316 return
317 }
318
319 w.Write(payload)
320 }))
321}
322
323func (l *listener) Accept() (c net.Conn, err error) {
324 c, err = l.inner.Accept()

Callers 15

TestTracingIngressSpanFunction · 0.70
TestTracingSpanNameFunction · 0.70
TestClientTimeoutFunction · 0.70
TestGetRoundtripFunction · 0.70
TestPostRoundtripFunction · 0.70
TestRouteFunction · 0.70
TestStreamingFunction · 0.70
TestAppliesFiltersFunction · 0.70

Calls 6

checkStruct · 0.85
writePartsFunction · 0.85
SetMethod · 0.65
HeaderMethod · 0.45
WriteHeaderMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…