发送带边界的分段/混合请求

时间:2019-02-19 19:45:05

标签: rest api spring-boot post resttemplate

我正在尝试创建一个包含两个部分的多部分混合请求:

  • application / x-url-form-encoded
  • multipart / form-data

示例请求:

POST http://sample:8080/api/documents HTTP/1.1
Accept: application/json
Accept-Language: en
API-Version: 2
Content-Type: multipart/mixed; boundary=19D523FB
Host: srv2012r2:8080
Content-Length: 11979
Expect: 100-continue

--19D523FB
Content-Type: multipart/form-data

{"fields":[{"Key":"e9e269b9-867f-4cf6-946f-db49091cd52d","Value":"Simplest document ever.docx"}],"storageappid":"d9ca0630-e4f8-4112-a411-ff04d89f2225"}

--19D523FB
Content-Type: multipart/x-www-form-urlencoded
Content-Disposition: attachment; filename="Simplest+document+ever.docx"

--19D523FB--

无法在Springboot中使用RestTemplate创建请求。

0 个答案:

没有答案