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

Support use of MockRestServiceServer with RestClient #30821

Closed
philwebb opened this issue Jul 5, 2023 · 1 comment
Closed

Support use of MockRestServiceServer with RestClient #30821

philwebb opened this issue Jul 5, 2023 · 1 comment
Assignees
Labels
in: test Issues in the test module in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@philwebb
Copy link
Member

philwebb commented Jul 5, 2023

AFAICT MockRestServiceServer cannot currently be used with the new RestClient interface. Perhaps a bindTo(RestClient.Builder) or a way to create a MockClientHttpRequestFactory instance could be added.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 5, 2023
@snicoll snicoll changed the title Prove a way to use MockRestServiceServer with RestClient Provide a way to use MockRestServiceServer with RestClient Jul 8, 2023
@rstoyanchev rstoyanchev self-assigned this Jul 11, 2023
@rstoyanchev rstoyanchev added in: test Issues in the test module in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jul 11, 2023
@rstoyanchev rstoyanchev added this to the 6.1.0-M2 milestone Jul 11, 2023
@rstoyanchev rstoyanchev changed the title Provide a way to use MockRestServiceServer with RestClient Support use of MockRestServiceServer with RestClient Jul 11, 2023
rstoyanchev added a commit that referenced this issue Jul 11, 2023
The method includes logic that is currently in
ViewResolutionResultHandler but fits well in BindingContext and also
includes the call to saveModel method from the InitBinderBindingContext
subclass, which was called too early until now from
RequestMappingHandlerAdapter before the model has been fully updated.

This mirrors a similar method in ModelFactory on the Spring MVC side
which also combines those two tasks.

Closes gh-30821
@NicoStrecker
Copy link

In my opionion restclient is not fully supported for MockRestServiceServer in Spring-Boot version 3.2.4 . BindTo does not really work when the restclient is already injected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants