我只是尝试从SurrealDB 文档运行第一个查询。
DATA="INFO FOR DB;"
curl --request POST \
--header "Content-Type: application/json" \
--user "root:root" \
--data "${DATA}" \
http://localhost:8000/sql这将导致以下错误:
{
"code": 415,
"details": "Unsupported media type",
"description": "The request needs to adhere to certain constraints. Refer to the documentation for supported content types."
}为什么文档中的查询不能工作?
发布于 2022-10-03 04:46:21
Content-Type: application/json是不再需要了。
您需要用Accept: application/json替换它。
DATA="INFO FOR DB;"
curl --request POST \
--header "Accept: application/json" \
--user "root:root" \
--data "${DATA}" \
http://localhost:8000/sql关于这件事,吉特布上有个问题。
在1.0.0-beta.7中,服务器要求(错误地)设置内容类型标头,但在1.0.0-beta.8中将其更改为接受。
https://stackoverflow.com/questions/73931182
复制相似问题