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

WebTestClient Support WebFilter only [SPR-15499] #20058

Closed
spring-projects-issues opened this issue May 1, 2017 · 3 comments
Closed

WebTestClient Support WebFilter only [SPR-15499] #20058

spring-projects-issues opened this issue May 1, 2017 · 3 comments
Assignees
Labels
in: test in: web type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented May 1, 2017

Rob Winch opened SPR-15499 and commented

#19912 added support for WebFilter. However, there is not a way to only test a WebFilter with it. This means anyone testing only WebFilter objects must mock a Controller, ApplicationContext, or RouterFunction to test the WebFitler.

It would be nice if there was a way that allowed testing just the WebFilter.


Referenced from: commits add1305, 16901b1

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 2, 2017

Rossen Stoyanchev commented

Testing a WebFilter is more low level than the other bindTo options. I was already considering a bindToHttpHandler variant as a natural addition to the other "mock server" bindTo variants that effectively result in using an HttpHandler.

This would cover any scenario that requires full control over the HttpHandler to test with including something like testing a single WebFilter:

HttpHandler handler = WebHttpHandlerBuilder.webHandler(e -> Mono.empty()).filters(myFilter).build();
WebTestClient client = WebTestClient.bindToHttpHandler(handler).build();
// ...

How does that sound?

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 2, 2017

Rob Winch commented

Rossen Stoyanchev I like that even better since it provides more flexibility. Thanks!

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 5, 2017

Rob Winch commented

Rossen Stoyanchev Thanks for the fast turnaround. Any chance it could support WebFilter...? The current implementation appears to accept only a List<WebFilter>?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test in: web type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants