| 936 | } |
| 937 | |
| 938 | func Test_Integration_Domain_WithSession(t *testing.T) { |
| 939 | t.Parallel() |
| 940 | |
| 941 | app := fiber.New() |
| 942 | app.Use(session.New()) |
| 943 | |
| 944 | app.Domain("api.example.com").Get("/session", func(c fiber.Ctx) error { |
| 945 | sess := session.FromContext(c) |
| 946 | if sess == nil { |
| 947 | return c.Status(fiber.StatusInternalServerError).SendString("no session") |
| 948 | } |
| 949 | sess.Set("domain", "api") |
| 950 | return c.SendString("session set") |
| 951 | }) |
| 952 | |
| 953 | req := httptest.NewRequest(http.MethodGet, "/session", http.NoBody) |
| 954 | req.Host = "api.example.com" |
| 955 | resp, err := app.Test(req) |
| 956 | require.NoError(t, err) |
| 957 | require.Equal(t, fiber.StatusOK, resp.StatusCode) |
| 958 | require.Contains(t, resp.Header.Get(fiber.HeaderSetCookie), "session_id=") |
| 959 | } |
| 960 | |
| 961 | func Test_Integration_Domain_WithCompress(t *testing.T) { |
| 962 | t.Parallel() |