isRawHTTPResponse returns true if data starts with "HTTP/", indicating it contains a complete HTTP response (status line + headers + body) rather than just a response body.
(data []byte)
| 238 | // it contains a complete HTTP response (status line + headers + body) rather |
| 239 | // than just a response body. |
| 240 | func isRawHTTPResponse(data []byte) bool { |
| 241 | return bytes.HasPrefix(data, []byte("HTTP/")) |
| 242 | } |
| 243 | |
| 244 | // writeRawHTTPResponse parses data as a complete HTTP response and replays it, |
| 245 | // copying the status code, headers, and body to w. This supports error fixtures |