我想通过多部分/表单数据将文件从Python发布到Jenkins。请求主体看起来是这样的:将文件发布到Jenkins失败
--===============1849003312==
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
Content-Disposition: file; name="file0"; filename="meta.xml"
PHhtbD4NCjwveG1sPg0K
--===============1849003312==--
这将导致詹金斯但其最终引发异常,其中最相关的位如下:
Exception: <br>Stacktrace: <pre>org.apache.commons.fileupload.FileUploadException: Stream ended unexpectedly
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:381)
at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
at org.kohsuke.stapler.RequestImpl.parseMultipartFormData(RequestImpl.java:767)
at org.kohsuke.stapler.RequestImpl.getSubmittedForm(RequestImpl.java:782)
这有什么错我的POST请求?
编辑: 请求头如下:
的Content-Type:
multipart/form-data; boundary="===============1849003312=="
MIME-版本:
1.0
POST请求的Content-Type头是什么?请张贴它的价值,这很重要。 –
@Wladimir Palant Done – aknuds1
“Content-Type”标题中的边界与POST正文中使用的边界不匹配。 –