加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

CURL CouchDB复制命令 – 无效的JSON

发布时间:2020-12-14 01:22:00 所属栏目:Linux 来源:网络整理
导读:我在curl中运行以下行试图设置couchdb复制: curl -X POST -d '{"source":"http://user:password@siteA.com:5984/main","target":"main"}' -H 'Content-Type: application/json' http://user:password@siteB.com/_replicate 它不断返回以下错误: {"error":"
我在curl中运行以下行试图设置couchdb复制:

curl -X POST -d '{"source":"http://user:password@siteA.com:5984/main","target":"main"}' -H 'Content-Type: application/json' http://user:password@siteB.com/_replicate

它不断返回以下错误:

{"error":"bad_request","reason":"invalid UTF-8 JSON"}

据我所知,JSON似乎有效.有任何想法吗?

我也在使用Powershell.

解决方法

它也经常发生在我身上. PowerShell解析器(谁知道原因)删除了json中的引号.

所以它发送它像'{来源:http:// user:password@siteA.com:5984 / main,target:main}’
你需要像这样调用它:

curl -X POST -d '{"""source""":"""http://user:password@siteA.com:5984/main""","""target""":"""main"""}' -H 'Content-Type: application/json' http://user:password@siteB.com/_replicate

看看http://pscx.codeplex.com/模块.发现此类问题时,EchoArgs可能会有所帮助.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读