package httpx import ( "net/http" "testing" "github.com/gofiber/fiber/v3" ) // MustTest executes a Fiber test request and fails on transport errors. func MustTest(t testing.TB, app *fiber.App, req *http.Request) *http.Response { t.Helper() resp, err := app.Test(req) if err != nil { t.Fatalf("app.Test failed: %v", err) } return resp } // AssertStatusAndClose validates status code and closes response body. func AssertStatusAndClose(t testing.TB, resp *http.Response, want int, msg string) { t.Helper() defer func() { _ = resp.Body.Close() }() if resp.StatusCode != want { t.Fatalf("%s: status=%d want=%d", msg, resp.StatusCode, want) } }