0

我正在尝试发送内容类型的请求multipart/mixed

只需在我的控制器中打印请求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 
4

1 回答 1

1

multipart/mixed content-type用于text/plain带有attachment. 请求中有附件吗?如果您不向请求发送附件,那么它将抱怨多部分边界。

尝试添加一个附件(比如在 REST 控制台中的请求中添加一个虚拟文件),您应该会看到它正常工作。

此内容类型主要用于电子邮件内容 [SMTP]。遵守边界,text/plain内容将转换为消息体。您可以将消息正文作为HttpServletRequest.getInputStream

于 2013-05-16T01:16:09.303 回答