Improve support for custom HTTP verbs in Spring MVC Test [SPR-13719] #18292
Labels
in: test
Issues in the test module
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Kamill Sokol opened SPR-13719 and commented
In Spring MVC we can build web applications using custom http verbs.
Unfortunately, Spring MVC Test only supports GET, POST, HEAD, OPTIONS, PUT, PATCH, DELETE, TRACE and file upload.
If we want to test custom http verbs we have to duplicate most of the code due to the strict design.
In my opinion, custom http verbs won't be needed very often and hence it shouldn't be backed into Spring MVC Test. Rather it should be partly open for extension.
Proposal
Add constructor to MockHttpServletRequestBuilder that supports http method as a string parameter. With this addition in place we can build http requests with arbitrary verbs.
One can think of extending MockMvcRequestBuilders, too. API might look like this:
I leave it open for discussion whether MockMvcRequestBuilders has to be changed, too.
If requested, I can contribute code to the Spring Github repository.
-This Jira issues relates to SPR-10426-
This Jira issues relates to #9476.
Affects: 4.2.3
Issue Links:
The text was updated successfully, but these errors were encountered: