From 2628bbefbf2082452e8e970088b0bc7036fe8a8c Mon Sep 17 00:00:00 2001 From: Milan Nikolic Date: Sun, 6 Oct 2019 02:48:39 +0200 Subject: [PATCH] Allow HEAD --- handlers/jpeg.go | 2 +- handlers/mjpeg.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/jpeg.go b/handlers/jpeg.go index 69bafd3..3ed8389 100644 --- a/handlers/jpeg.go +++ b/handlers/jpeg.go @@ -20,7 +20,7 @@ func NewJPEG(reader reader.ImageReader) *JPEG { // ServeHTTP handles requests on incoming connections. func (j *JPEG) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if r.Method != "GET" { + if r.Method != "GET" && r.Method != "HEAD" { http.Error(w, "405 Method Not Allowed", http.StatusMethodNotAllowed) return } diff --git a/handlers/mjpeg.go b/handlers/mjpeg.go index 6893c1d..59073f5 100644 --- a/handlers/mjpeg.go +++ b/handlers/mjpeg.go @@ -26,7 +26,7 @@ func NewMJPEG(reader reader.ImageReader, delay int) *MJPEG { // ServeHTTP handles requests on incoming connections. func (m *MJPEG) ServeHTTP(w http.ResponseWriter, r *http.Request) { - if r.Method != "GET" { + if r.Method != "GET" && r.Method != "HEAD" { http.Error(w, "405 Method Not Allowed", http.StatusMethodNotAllowed) return }