我正在尝试发送内容类型为 multipart/mixed
的请求
只需在我的 Controller 中使用 println params
行打印请求
但是,我不断收到错误消息:the request was rejected because no multipart boundary was found
我不确定这是 grails 中的问题还是我的请求搞砸了。我正在使用 RESTConsole 并将内容类型设置为 multipart/mixed
并将以下内容作为 RAW Body 发送:
--boundary42
Content-Type: text/plain; charset=us-ascii
...plain text version of message goes here....
--boundary42
Content-Type: text/richtext
.... richtext version of same message goes here ...
--boundary42
最佳答案
multipart/mixed
content-type
用于 text/plain
请求 attachment
.请求中有附件吗?如果您不向请求发送附件,那么它将提示多部分边界。
尝试添加一个附件(比如在 REST 控制台中的请求中添加一个虚拟文件),您应该会看到它工作正常。
此内容类型主要用于电子邮件内容 [SMTP]。坚守边界,text/plain
内容将被转换为消息正文。您可以获取消息正文为 HttpServletRequest.getInputStream
关于http - 请求被拒绝,因为在 Grails 中没有找到多部分边界,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16577370/