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

[FEATURE REQUEST] httptest strict/require setting #1722

Closed
kalmant opened this issue Feb 4, 2021 · 2 comments
Closed

[FEATURE REQUEST] httptest strict/require setting #1722

kalmant opened this issue Feb 4, 2021 · 2 comments
Assignees
Labels
good first issue A user wrote a good first issue with clear instructions 🚀 status:implemented 💡type:idea
Milestone

Comments

@kalmant
Copy link

kalmant commented Feb 4, 2021

Is your feature request related to a problem? Please describe.
During testing I expected github.com/kataras/iris/v12/httptest.Response.Status to fail the test immediately if a different status is received. Therefore on subsequent lines I performed some operations that could result in a panic if let's say the response code was not as expected. It turns that it does not fail fast, it simply fails the test. This is because New configures Expect with Reporter: httpexpect.NewAssertReporter(t).

Describe the solution you'd like
I would like to be able to set Reporter to httpexpect.NewRequireReporter(t). I think this could be done by extending Configuration with a new field (e.g. Require bool or Strict bool) and then configuring httpexpect.Config using that value. I'd be happy to contribute this solution.

Describe alternatives you've considered
I have considered copy pasting github.com/kataras/iris/v12/httptest.New and manually setting Reporter to httpexpect.NewRequireReporter(t) (where httpexpect is actually github.com/iris-contrib/httpexpect/v2) by copying httptest.New but I think that's not the right way to go about things.

Additional context
None

@kataras kataras added the good first issue A user wrote a good first issue with clear instructions label Feb 8, 2021
@kataras kataras added this to the v12.2.0 milestone Feb 13, 2021
@kataras
Copy link
Owner

kataras commented Feb 13, 2021

Hello @kalmant, sorry for the delay. It's added, upgrade to the @master and you're ready to use it. The otpion name is Strict. Please check the commit to see how I did that so you can open PRs with more confident in the future. Good in-point feature request with clear "wants" and details, good job!

@kalmant
Copy link
Author

kalmant commented Feb 15, 2021

Thanks a lot!

@kalmant kalmant closed this as completed Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue A user wrote a good first issue with clear instructions 🚀 status:implemented 💡type:idea
Projects
None yet
Development

No branches or pull requests

2 participants