从邮递员生成 cURL 请求



我尝试从邮递员生成一个cURL请求(使用邮递员的选项code(。
由于请求包含输入 pdf 文件,因此邮递员正在添加某些标头属性。
下面是生成的 curl(几乎相似,出于安全原因更改了一些标头(,收到的响应500, internal Server Error, "Current request is not a multipart request"

  http://localhost:8080/test 
  -H 'Accept: application/json' 
  -H 'Content-Type: application/x-www-form-urlencoded,multipart/form-data; boundary=--------------------------895926775956600620357522' 
  -H 'Some-Key: abcd' 
  -H 'cache-control: no-cache' 
  -F file=@/C:/path/to/my/file/abc.pdf

如果要在Postman中发送multipart请求,则只需执行以下操作:

  1. 不要在 Header 中指定Content-Type
  2. 在邮递员Body选项卡中,您应该选择form-data并选择file type

在此处阅读更多内容。

最新更新