邮递员多部分/表单数据错误:缺少开始边界

2022-01-22 00:00:00 postman multipart java

我正在尝试使用 Postman 发送的 multipart/form-data 请求访问我的服务器端点.我收到 400 错误请求,原因是:

I'm trying to hit my server's endpoint with a multipart/form-data request sent from Postman. I'm getting a 400 Bad Request and the cause is:

org.jvnet.mimepull.MIMEParsingException: Missing start boundary.

如何设置起始边界以及如何知道它应该是什么?

How can I set the start boundary and how do I know what it should be?

推荐答案

https://github.com/postmanlabs/postman-app-support/issues/191 在此线程之后,似乎将请求标头设置为 Content-Type multipart/form-data 我正在覆盖 Postman 设置的值.

https://github.com/postmanlabs/postman-app-support/issues/191 Following that thread here seems that setting the request header to Content-Type multipart/form-data I'm overriding the value set by Postman.

无需手动添加内容类型标头.你是覆盖 Postman 设置的值.只需在 POST 中选择表单数据请求并发送您的请求,看看它是否有效.

There is no need to add a content-type header manually. You are overriding the value set by Postman. Just select form-data in POST request and send your request to see if it works.

删除标头允许我到达我的端点.

Removing the header allowed me to hit my endpoint.

相关文章