(payload []byte, parts int, check requestCheck)
| 298 | } |
| 299 | |
| 300 | func 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 | |
| 323 | func (l *listener) Accept() (c net.Conn, err error) { |
| 324 | c, err = l.inner.Accept() |
no test coverage detected
searching dependent graphs…