API 平台 - 开发 - 所有请求都返回空结果

时间:2021-03-25 20:30:50

标签: api-platform.com

我已经设置了 API 平台,并且正在尝试使用 curl 测试 API,例如。

curl -X POST -H "Content-Type: application/json" http://localhost/authentication_token -d '{"email":"test@test.com","password":"the_new_password"}'

curl http://localhost/docs

我没有得到服务器的响应,总是空白。

1 个答案:

答案 0 :(得分:0)

请求必须是 HTTPS,因为 HTTP 请求似乎被简单地丢弃/忽略了。添加 -k 标志,因为证书将是自签名的,并且 CURL 会出错。

curl -X POST -H "Content-Type: application/json" https://localhost/authentication_token -d '{"email":"test@test.com","password":"the_new_password"}' -k

curl https://localhost/docs -k

相关问题