(t *testing.T)
| 1029 | } |
| 1030 | |
| 1031 | func Test_Domain_RouteChainAllMethods(t *testing.T) { |
| 1032 | t.Parallel() |
| 1033 | |
| 1034 | app := New() |
| 1035 | |
| 1036 | rc := app.Domain("api.example.com").RouteChain("/test") |
| 1037 | rc.All(func(c Ctx) error { |
| 1038 | c.Set("X-All", "yes") |
| 1039 | return c.Next() |
| 1040 | }) |
| 1041 | rc.Head(func(c Ctx) error { |
| 1042 | return c.SendStatus(StatusOK) |
| 1043 | }) |
| 1044 | rc.Put(func(c Ctx) error { |
| 1045 | return c.SendString("put") |
| 1046 | }) |
| 1047 | rc.Delete(func(c Ctx) error { |
| 1048 | return c.SendString("delete") |
| 1049 | }) |
| 1050 | rc.Connect(func(c Ctx) error { |
| 1051 | return c.SendString("connect") |
| 1052 | }) |
| 1053 | rc.Options(func(c Ctx) error { |
| 1054 | return c.SendString("options") |
| 1055 | }) |
| 1056 | rc.Trace(func(c Ctx) error { |
| 1057 | return c.SendString("trace") |
| 1058 | }) |
| 1059 | rc.Patch(func(c Ctx) error { |
| 1060 | return c.SendString("patch") |
| 1061 | }) |
| 1062 | rc.Query(func(c Ctx) error { |
| 1063 | return c.SendString("query") |
| 1064 | }) |
| 1065 | |
| 1066 | for _, method := range []string{MethodPut, MethodDelete, MethodPatch, MethodOptions, MethodQuery} { |
| 1067 | req := httptest.NewRequest(method, "/test", http.NoBody) |
| 1068 | req.Host = "api.example.com" |
| 1069 | resp, err := app.Test(req) |
| 1070 | require.NoError(t, err) |
| 1071 | require.Equal(t, StatusOK, resp.StatusCode) |
| 1072 | } |
| 1073 | } |
| 1074 | |
| 1075 | func Test_parseDomainPattern(t *testing.T) { |
| 1076 | t.Parallel() |
nothing calls this directly
no test coverage detected