我收到此错误消息:
json解析错误:顶级值(202020207b202020202020226b696e64223a2022536563726574222c2020 ...)之后的无效字符'E'
我正在从我的shell脚本中启动curl语句:
curl -k \
-X PUT \
-d @- \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
"$SERVER_URL/api/v1/namespaces/$NAMESPACE/secrets/t-secret" <<'EOF'
{
"kind": "Secret",
"apiVersion": "v1",
"data": {
"rabbit-password": "fromcontainer"
}
}
EOF
有什么想法吗?
答案 0 :(得分:1)
您不能在结尾的EOF
上加上空格。
curl -k \
-X PUT \
-d @- \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
"$SERVER_URL/api/v1/namespaces/$NAMESPACE/secrets/t-secret" <<'EOF'
{
"kind": "Secret",
"apiVersion": "v1",
"data": {
"rabbit-password": "fromcontainer"
}
}
EOF