chao/RESTClient

post无效.

Closed this issue · 2 comments

post

http://localhost/api/v1/test/ttt

data
abc=333

通过工具返回

{
  "_fun": "ttt",
  "version": "6.0.2",
  "input": "13",
  "test": {
    "post": []
  }
}

而通过curl

C:\Users\xjw11>curl -X POST -i http://localhost/api/v1/test/ttt --data abc=333
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Server: Caddy
X-Powered-By: PHP/7.3.11
Date: Sun, 21 Jun 2020 12:42:24 GMT
Content-Length: 76

{"_fun":"ttt","version":"6.0.2","input":"333","test":{"post":{"abc":"333"}}}

yzy-1 commented

我也遇到了一样的问题

yzy-1 commented

解决方法是:添加一个 HTTP 头字段

  • 名称: Content-Type
  • 值: application/x-www-form-urlencoded