mirror of
https://github.com/labstack/echo.git
synced 2025-06-15 00:14:57 +02:00
Handling 405 & pre-flight requests
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
@ -382,12 +382,15 @@ func TestEchoNotFound(t *testing.T) {
|
||||
assert.Equal(t, http.StatusNotFound, w.Code)
|
||||
}
|
||||
|
||||
func TestEchoBadRequest(t *testing.T) {
|
||||
func TestEchoMethodNotAllowed(t *testing.T) {
|
||||
e := New()
|
||||
r, _ := http.NewRequest("INVALID", "/files", nil)
|
||||
e.Get("/", func(c *Context) error {
|
||||
return c.String(http.StatusOK, "Echo!")
|
||||
})
|
||||
r, _ := http.NewRequest(POST, "/", nil)
|
||||
w := httptest.NewRecorder()
|
||||
e.ServeHTTP(w, r)
|
||||
assert.Equal(t, http.StatusBadRequest, w.Code)
|
||||
assert.Equal(t, http.StatusMethodNotAllowed, w.Code)
|
||||
}
|
||||
|
||||
func TestEchoHTTPError(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user