api-platform.com - 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
我没有得到服务器的响应,总是空白。
解决方案
请求必须是 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
推荐阅读
- django - 按其中一个键的值拆分字典(将其保存为单个数据)
- linux - bash 替换 ${} 占位符作为附件
- java - 返回语句后执行异步调用 Reactive Core + Spring Boot
- google-cloud-platform - 如何在 gcloud 实例上打开端口?
- kotlin - Kotlin 中 null 安全性的最佳实践
- hive - 如何在 impala 中实现非规范化数据
- android - 当通知到达 Android 时,如何使用 react-native-firebase 唤醒设备?
- python - 从中序和前序遍历构造二叉树的空间复杂度
- firebase - 在 Firestore 规则中使用 resource.data
- ruby-on-rails - 两个活动记录对象的分页