-
Notifications
You must be signed in to change notification settings - Fork 736
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
Add support for RestTemplate #478
Comments
I think it might be possible to support RestTemplate, but I don't think it's worth the initial engineering effort or the ongoing maintenance cost. Spring Framework's WebTestClient is the preferred, modern replacement for RestTemplate and, as you've noted above, it's already supported by REST Docs. Thanks anyway for the suggestion. |
@wilkinsona "WebTestClient is a replacement for RestTemplate" since when? I did not know about that. Can u point me to an article or documentation to read more about this replacement and why was needed? Would gladly update our tests. |
Sorry, replacement probably wasn't quite the right word. |
Got it, but can u point me to an article or documentation explaining how and why WebTestClient is the preferable option over RestTemplate. Thanks |
Sorry, I'm not aware of such an article. |
Any chance to reconsider this? |
Never say never but at this time I am yet to be convinced that it is worth the effort both in terms of the initial development and ongoing maintenance. From what I have seen, tests that use an HTTP server are far less common than those that use mock web infrastructure. This also shows in the download numbers for REST Docs' existing modules with I think that spring-projects/spring-framework#31275 is worth keeping an eye on. If a new |
Thanks for pointing me to spring-projects/spring-framework#31275! I will definitely keep an eye on it. |
According to https://docs.spring.io/spring-restdocs/docs/current/reference/html5/ the following frameworks are supported: Spring MVC’s test framework, Spring WebFlux’s WebTestClient or REST Assured 3
Many component tests though are using just simple RestTemplate, without having the need to add any of the dependencies mentioned above. Now just to use restdocs those component tests must be changed to use let's say rest assured 3.
Would it be possible to add restdocs support for RestTemplate usage?
The text was updated successfully, but these errors were encountered: