(t *testing.T)
| 333 | } |
| 334 | |
| 335 | func TestResponseHeaderEmptyValueFromString(t *testing.T) { |
| 336 | t.Parallel() |
| 337 | |
| 338 | s := "HTTP/1.1 200 OK\r\n" + |
| 339 | "EmptyValue1:\r\n" + |
| 340 | "Content-Type: foo/bar\r\n" + |
| 341 | "EmptyValue2: \r\n" + |
| 342 | "\r\n" |
| 343 | |
| 344 | var h ResponseHeader |
| 345 | br := bufio.NewReader(bytes.NewBufferString(s)) |
| 346 | if err := h.Read(br); err != nil { |
| 347 | t.Fatalf("unexpected error: %v", err) |
| 348 | } |
| 349 | if string(h.ContentType()) != "foo/bar" { |
| 350 | t.Fatalf("unexpected content-type: %q. Expecting %q", h.ContentType(), "foo/bar") |
| 351 | } |
| 352 | v1 := h.Peek("EmptyValue1") |
| 353 | if len(v1) > 0 { |
| 354 | t.Fatalf("expecting empty value. Got %q", v1) |
| 355 | } |
| 356 | v2 := h.Peek("EmptyValue2") |
| 357 | if len(v2) > 0 { |
| 358 | t.Fatalf("expecting empty value. Got %q", v2) |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | func TestRequestHeaderEmptyValueFromHeader(t *testing.T) { |
| 363 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…