多部分/表单数据请求是否无边界有效?根据规范,当有超过 1 个部分时,使用边界将它们分开(并且这个边界不应该是 body 的一部分)。我有一个请求,其中有一个主体作为原始内容或文件,并且在我们传递的内容类型中 "multipart/form-data"。这种要求真的有效吗?
最佳答案
我认为没有边界的multipart/form-data
请求无效。
根据 RFC7231 , 只有 1 部分的请求仍然是有效的 multipart
MIME 类型并且应该遵循 multipart
MIME 规则:
MIME provides for a number of "multipart" types -- encapsulations of one or more representations within a single message body. All multipart types share a common syntax ... and include a boundary parameter as part of the media type value.
根据 RFC2046 ,“边界”是必需的和强制性的:
The Content-Type field for multipart entities requires one parameter, "boundary".
...
The only mandatory global parameter for the "multipart" media type is the boundary parameter
关于http - 无边界的多部分/表单数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43932900/