summaryrefslogtreecommitdiff
path: root/internal/handlers/types.go
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2022-04-04 09:58:01 +1000
committerGitHub <noreply@github.com>2022-04-04 09:58:01 +1000
commit2502d896824a23fe2eeda9434b12b7d6cf834924 (patch)
tree53cc70ccd059d9b274ca8b3b9a5e8bbfbf4ca3f1 /internal/handlers/types.go
parentfa143ea029d453c2228e9f5f8c1438efb2b997c5 (diff)
fix(server): respond with 404/405 appropriately (#3087)
This adjusts the not found handler to not respond with a 404 on not found endpoints that are part of the /api or /.well-known folders, and respond with a 405 when the method isn't implemented. Co-authored-by: Amir Zarrinkafsh <nightah@me.com>
Diffstat (limited to 'internal/handlers/types.go')
-rw-r--r--internal/handlers/types.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/handlers/types.go b/internal/handlers/types.go
index e4670220e..33e096c25 100644
--- a/internal/handlers/types.go
+++ b/internal/handlers/types.go
@@ -1,6 +1,8 @@
package handlers
import (
+ "io"
+
"github.com/authelia/authelia/v4/internal/authentication"
)
@@ -124,3 +126,12 @@ type PassworPolicyBody struct {
RequireNumber bool `json:"require_number"`
RequireSpecial bool `json:"require_special"`
}
+
+type responseWriter interface {
+ SetStatusCode(statusCode int)
+ SetBodyString(body string)
+ SetBody(body []byte)
+ SetContentType(contentType string)
+ SetContentTypeBytes(contentType []byte)
+ SetBodyStream(bodyStream io.Reader, bodySize int)
+}