How to use spring's MockMultipartHttpServletRequest? Getting “no multipart boundary was found”

前端 未结 5 448
名媛妹妹
名媛妹妹 2021-01-02 10:53

Clearly I\'m not using this test fixture right. My servlet works just fine in tomcat, but when I try to use this mock, the multi-part boundary is not found. \"the request

5条回答
  •  攒了一身酷
    2021-01-02 11:37

    Great answer for Samuel, but a bug:

            String end = "\r\n"+ boundary + "--";
    

    should be:

            String end = "--"+ boundary + "--";
    

    Thanks for his work very much.

提交回复
热议问题