首页 > 解决方案 > API 平台 - 开发 - 所有请求都返回空结果

问题描述

我已经设置了 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

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

标签: api-platform.com

解决方案


请求必须是 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


推荐阅读