f-lopes/spring-mvc-test-utils

Support for multipart requests

Closed this issue · 2 comments

Hi @f-lopes ,
it is very common to send files together with a form. It would be nice to add full support for multipart requests or at least set some methods to public so that the main functionality can be accessed.

Kind regards,
Stefan

After a fork I realized a method to allow multipart requests with the current version. I'd like to share it for others as a reference:

    MockHttpServletRequestBuilder multipart = MockMvcRequestBuilders.multipart("/path")
        .file(multipartFile)
        .with(MockMvcRequestBuilderUtils.form(form));

Hi @SimonStefan,

I am glad you found a solution, and thank you for sharing it!