add miscellaneous tests

also fix minor bug in detecting content type for content less than 512
bytes.
This commit is contained in:
Will Norris 2019-06-11 14:02:44 -07:00
parent 6975320eb4
commit a7a8966289
4 changed files with 33 additions and 3 deletions

View file

@ -215,7 +215,7 @@ func (p *Proxy) serveImage(w http.ResponseWriter, r *http.Request) {
// the content type. Returns empty string if error occurs.
func peekContentType(p *bufio.Reader) string {
byt, err := p.Peek(512)
if err != nil && err != bufio.ErrBufferFull {
if err != nil && err != bufio.ErrBufferFull && err != io.EOF {
return ""
}
return http.DetectContentType(byt)