本文翻译自:Tool for sending multipart/form-data request [closed]
I am currently using the Chrome Addon Postman - REST Client to easily create POST / GET request. 我目前正在使用Chrome Addon Postman - REST客户端轻松创建POST / GET请求。
Now I want to debug an upload script and I am looking for a tool to make requests encoded as "multipart/form-data" so that I can send also a file. 现在我想调试上传脚本,我正在寻找一个工具来将请求编码为“multipart / form-data”,这样我也可以发送一个文件。
#1楼
参考:https://stackoom.com/question/15CNI/发送multipart-form-data请求的工具-关闭
#2楼
UPDATE: I have created a video on sending multipart/form-data requests to explain this better. 更新:我已经创建了一个关于发送multipart / form-data请求的视频来更好地解释这个问题。
Actually, Postman can do this. 实际上, 邮差可以做到这一点。 Here is a screenshot 这是一个截图
Newer version : Screenshot captured from postman chrome extension 较新版本 :从postman chrome扩展程序中捕获的屏幕截图
Another version 另一个版本
Older version 旧版本
Make sure you check the comment from @maxkoryukov 请务必查看@maxkoryukov的评论
Be careful with explicit Content-Type header. 注意显式的Content-Type标头。 Better - do not set it's value, the Postman is smart enough to fill this header for you. 更好 - 不要设置它的价值,Postman足够聪明,可以为你填充这个标题。 BUT, if you want to set the Content-Type: multipart/form-data - do not forget about boundary field . 但是,如果要设置Content-Type:multipart / form-data,请不要忘记边界字段 。
#3楼
The usual error is one tries to put Content-Type: {multipart/form-data}
into the header of the post request. 通常的错误是尝试将Content-Type: {multipart/form-data}
放入post请求的标头中。 That will fail, it is best to let Postman do it for you. 那会失败,最好让邮差为你做。 For example: 例如: