Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 How about compatibling with httpexpect #485

Closed
kiyonlin opened this issue Jun 19, 2020 · 2 comments
Closed

🚀 How about compatibling with httpexpect #485

kiyonlin opened this issue Jun 19, 2020 · 2 comments

Comments

@kiyonlin
Copy link
Contributor

Is your feature request related to a problem?
No

Describe the solution you'd like
httpexpect already supports fasthttp binder.

The only thing to do is making app.handler accessable.

Simple example:

// fiberHTTPTester returns a new Expect instance to test FiberHandler().
func fiberHTTPTester(t *testing.T) *httpexpect.Expect {
	app := fiber.New()
	app.Get("ping", func(c *fiber.Ctx) {
		c.SendString("pong")
	})
	return httpexpect.WithConfig(httpexpect.Config{
		Client:   &http.Client{Transport: httpexpect.NewFastBinder(app.Handler)},
		Reporter: t,
	})
}

func TestFastHTTP(t *testing.T) {
	e := fiberHTTPTester(t)

	e.GET("/ping").Expect().
		Status(200).
		Text().Equal("pong")
}
@ReneWerner87
Copy link
Member

#504
added the possibility to access the handler

Fenny added a commit that referenced this issue Jun 25, 2020
🚀 How about compatibling with httpexpect #485
@Fenny
Copy link
Member

Fenny commented Jun 25, 2020

Will be tagged in v1.12.1 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants