summaryrefslogtreecommitdiff
path: root/srv/src/api/middleware.go
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-05-17 15:54:20 -0600
committerBrian Picciano <mediocregopher@gmail.com>2022-05-17 15:54:20 -0600
commit69de76cb32cfd638672d4d5846d0659bf102316f (patch)
treefd2a1f9fdd815a70eb514b54dbcacc24b8e402cc /srv/src/api/middleware.go
parente406ad6e7c82592d3bbaa1cf93ffc1612e4f196c (diff)
Add asset file upload form, plus related necessary refactors
Diffstat (limited to 'srv/src/api/middleware.go')
-rw-r--r--srv/src/api/middleware.go6
1 files changed, 3 insertions, 3 deletions
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
}