mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-05-16 23:35:13 +02:00
add miscellaneous tests
also fix minor bug in detecting content type for content less than 512 bytes.
This commit is contained in:
parent
6975320eb4
commit
a7a8966289
4 changed files with 33 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue