From 69de76cb32cfd638672d4d5846d0659bf102316f Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Tue, 17 May 2022 15:54:20 -0600 Subject: Add asset file upload form, plus related necessary refactors --- srv/src/api/middleware.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'srv/src/api/middleware.go') diff --git a/srv/src/api/middleware.go b/srv/src/api/middleware.go index fcd29b3..974889b 100644 --- a/srv/src/api/middleware.go +++ b/srv/src/api/middleware.go @@ -80,11 +80,11 @@ func logReqMiddleware(h http.Handler) http.Handler { }) } -func postOnlyMiddleware(h http.Handler) http.Handler { +func disallowGetMiddleware(h http.Handler) http.Handler { return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - // we allow websockets to not be POSTs because, well, they can't be - if r.Method == "POST" || r.Header.Get("Upgrade") == "websocket" { + // we allow websockets to be GETs because, well, they must be + if r.Method != "GET" || r.Header.Get("Upgrade") == "websocket" { h.ServeHTTP(rw, r) return } -- cgit v1.2.3