diff options
author | Julien Dessaux | 2021-07-26 18:34:25 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-07-26 18:34:25 +0200 |
commit | 863e6266c02a09d84570fe6f6884b95fa458ece3 (patch) | |
tree | 3dde8c2eb8a354d6b892aae70c00cef107fc24f2 /internal/webui/login_test.go | |
parent | Updated dependencies (diff) | |
download | trains-863e6266c02a09d84570fe6f6884b95fa458ece3.tar.gz trains-863e6266c02a09d84570fe6f6884b95fa458ece3.tar.bz2 trains-863e6266c02a09d84570fe6f6884b95fa458ece3.zip |
Added MethodNotAllowed errors to login webui handler
Diffstat (limited to 'internal/webui/login_test.go')
-rw-r--r-- | internal/webui/login_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/webui/login_test.go b/internal/webui/login_test.go index fe27f7e..0d661cb 100644 --- a/internal/webui/login_test.go +++ b/internal/webui/login_test.go @@ -187,4 +187,27 @@ func TestLoginHandler(t *testing.T) { err: &statusError{http.StatusNotFound, simpleErrorMessage}, }, }) + // Test other request types + methods := []string{ + http.MethodConnect, + http.MethodDelete, + http.MethodHead, + http.MethodOptions, + http.MethodPatch, + http.MethodPut, + http.MethodTrace, + } + for _, method := range methods { + runHttpTest(t, e, loginHandler, &httpTestCase{ + name: "a login attempt with an invalid method should error", + input: httpTestInput{ + method: method, + path: "/login", + }, + expect: httpTestExpect{ + code: http.StatusMethodNotAllowed, + err: &statusError{http.StatusMethodNotAllowed, simpleErrorMessage}, + }, + }) + } } |