database - CouchDB 中的 "Content-Type must be application/json"错误

标签 database http rest post couchdb

基本上,每当我尝试使用 POST 向我的 CouchDB 发送内容时,我都会收到此错误:

{"error":"bad_content_type","reason":"Content-Type must be application/json"}

我已经尝试使用 Postman 和 Advanced Rest Client 这两个 chrome 插件,并且确保像这样设置 Content-Type header :

enter image description here

(使用高级 Rest 客户端)

enter image description here

(与 postman )

谁能帮帮我?我可能错过了设置 CouchDB 的一个基本步骤,但它确实有效,只是不接受 Content-Type。

最佳答案

Postman 有一个 Headers 按钮,您可以在其中添加 URL 参数键和值。该按钮位于 http 动词选择框的最右侧(您可以在其中指定 GET、POST 等)。您可能拥有基本的 auth 参数。为具有值 application/json 的键 Content-Type 添加一个。

关于database - CouchDB 中的 "Content-Type must be application/json"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21287497/

相关文章:

json - Mongo forEach 查询

javascript - Angularjs $http promise ;从 $http().then(fn1, fn2) 获取回调函数 fn1 和 fn2

java - 从java中的一个HTTP请求中读取HTTP响应头和正文

java - 打开 REST Web 服务返回的 PDF

java - 如何确定 ConstraintViolation 是来自 JSON 属性还是来自 URL 参数?

c#:在完成之前经过一定时间后重新启动异步任务

php - 如何按行显示 MySQL 数据?

mysql - 如何计算数据库中的属性

Mysql日期范围价格

python - 通过 HTTP 发送和接收简单的 JSON 消息