从邮递员生成cURL请求

时间:2019-07-16 10:21:49

标签: http curl postman multipartform-data

我尝试从邮递员生成一个cURL请求(使用邮递员的code选项)。
由于请求包含输入pdf文件,因此邮递员正在添加某些标头属性。
以下是生成的卷曲(几乎类似,出于安全原因更改了某些标头),收到了响应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

1 个答案:

答案 0 :(得分:0)

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

  1. 不要在Content-Type中指定Header
  2. 在邮递员的Body标签中,应选择form-data并选择file type

了解更多here