我想从 Postman 接收表单数据:
Content-Type: application/json
这是 WebApi 方法:
[HttpPost]
[Route("api/test")]
public async Task TestMethod(HttpRequestMessage request)
{
var test = await request.Content.ReadAsStringAsync();
}
我得到的是:
------WebKitFormBoundarypqDvmeG89cBR9mK9
Content-Disposition: form-data; name="test"
esad
------WebKitFormBoundarypqDvmeG89cBR9mK9--
但是我不想要数据,WebKitFormBoundary并且我限制只能使用 formdata。有没有其他办法?
HTTP调用信息:
POST /api/test HTTP/1.1
Host: localhost:16854
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Cache-Control: no-cache
Postman-Token: 1a3d6427-4956-707d-da0c-3a29a63c7563
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="test"
esad
------WebKitFormBoundary7MA4YWxkTrZu0gW--
卷曲调用信息:
curl -X POST \
http://localhost:16854/api/test \
-H 'cache-control: no-cache' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-H 'postman-token: 02055873-e9a8-e9a6-019c-b407992b0e2f' \
-F test=esad
幕布斯7119047
繁花不似锦
茅侃侃
相关分类