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

前端 未结 5 478
名媛妹妹
名媛妹妹 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条回答
  •  猫巷女王i
    2021-01-02 11:33

    Vote up for Samuel. Though spent one day trying to make it working. The problem was in:

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

    Should be:

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

提交回复
热议问题