找不到多部分边界

时间:2019-03-01 08:13:17

标签: spring spring-boot httprequest

使用Rest Client Chrome工具,我在请求中上传了一个名为sample.json的JSON文件。低于异常。 尝试将标头作为multipart / form-data传递,也没有传递后者。但是结果是一样的。我做对了吗?

sudo apt install gstreamer1.0-libav ubuntu-restricted-extras

..

select year,name,id
  from
      (
       select year,name,id, 
              row_number() over(partition by year order by id) rn 
         from mytable
      )s
 where rn=1

..

the request 
was rejected because no multipart boundary was found

2 个答案:

答案 0 :(得分:2)

仅针对您的眼睛,在 Java 中您可能会使用 :

String boundary = Long.toHexString(System.currentTimeMillis());
            request.getHeaders().setContentType("multipart/form-data; boundary="+boundary);

答案 1 :(得分:1)

您似乎没有在HTTP请求标头中指定边界-请参见此处了解我的意思Unable to send a multipart/mixed request to spring MVC based REST service

Content-Type: multipart/mixed;boundary=YourBoundaryOfChoiceHere