diff options
Diffstat (limited to 'workhorse/internal/upstream/notfoundunless.go')
-rw-r--r-- | workhorse/internal/upstream/notfoundunless.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/workhorse/internal/upstream/notfoundunless.go b/workhorse/internal/upstream/notfoundunless.go new file mode 100644 index 00000000000..3bbe3e873a4 --- /dev/null +++ b/workhorse/internal/upstream/notfoundunless.go @@ -0,0 +1,11 @@ +package upstream + +import "net/http" + +func NotFoundUnless(pass bool, handler http.Handler) http.Handler { + if pass { + return handler + } + + return http.HandlerFunc(http.NotFound) +} |