peekContentType peeks at the first 512 bytes of p, and attempts to detect the content type. Returns empty string if error occurs.
(p *bufio.Reader)
| 348 | // peekContentType peeks at the first 512 bytes of p, and attempts to detect |
| 349 | // the content type. Returns empty string if error occurs. |
| 350 | func peekContentType(p *bufio.Reader) string { |
| 351 | byt, err := p.Peek(512) |
| 352 | if err != nil && !errors.Is(err, bufio.ErrBufferFull) && !errors.Is(err, io.EOF) { |
| 353 | return "" |
| 354 | } |
| 355 | return http.DetectContentType(byt) |
| 356 | } |
| 357 | |
| 358 | // copyHeader copies values for specified headers from src to dst, adding to |
| 359 | // any existing values with the same header name. |
no outgoing calls