Allow HEAD

This commit is contained in:
Milan Nikolic
2019-10-06 02:48:39 +02:00
parent 3b0b066cc1
commit 2628bbefbf
2 changed files with 2 additions and 2 deletions

View File

@@ -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
}

View File

@@ -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
}