mirror of
https://github.com/labstack/echo.git
synced 2025-07-17 01:43:02 +02:00
Allow
header support in Router, MethodNotFoundHandler (405) and CORS middleware
This commit is contained in:
@ -716,13 +716,16 @@ func TestEchoNotFound(t *testing.T) {
|
||||
|
||||
func TestEchoMethodNotAllowed(t *testing.T) {
|
||||
e := New()
|
||||
|
||||
e.GET("/", func(c Context) error {
|
||||
return c.String(http.StatusOK, "Echo!")
|
||||
})
|
||||
req := httptest.NewRequest(http.MethodPost, "/", nil)
|
||||
rec := httptest.NewRecorder()
|
||||
e.ServeHTTP(rec, req)
|
||||
|
||||
assert.Equal(t, http.StatusMethodNotAllowed, rec.Code)
|
||||
assert.Equal(t, "OPTIONS, GET", rec.Header().Get(HeaderAllow))
|
||||
}
|
||||
|
||||
func TestEchoContext(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user