在本地实例中不支持ouchdb POST方法 [英] couchdb POST method not supported in local instance

查看:53
本文介绍了在本地实例中不支持ouchdb POST方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地的Sofadb实例似乎不支持POST方法。

My local instance of couchdb seems not to support the POST method.

这是我从chrome开发工具中得到的答案

This is the answer I have from chrome dev tools

POST http://localhost:5984/epos-couch/_design/epos-couch/_view/ri 415 (Unsupported Media Type)

使用的代码是一个简单的ajax请求,并设置了post方法:

the code in use is a simple ajax request with post method set:

$.ajax({ 
                    async: true, 
                    url: ajaxURL,
                    type:"POST",
                    data:.....,
                    dataType: 'json',
                    timeout:5000,
                    success:function(response){

                        riResponseList=response.rows;
                        },
                    error:function(){
                        alert('fetching error');
                        }
                    });

我很确定问题出在我的本地实例中,因为在 cloudant.com 一切正常。

I'm pretty sure the problem is in my local instance because running such code on cloudant.com everyhing works fine.

所以我的问题是:我怎么能设置我的沙发床本地实例以支持POST方法?

So my question is: how can I set my local instance of couchdb to support the POST method?

我在互联网上进行了一些搜索(http://wiki.apache.org/couchdb, http://guide.couchdb.org/ ),但找不到答案。

I searched on the interet a bit (http://wiki.apache.org/couchdb, http://guide.couchdb.org/) but couln't find an answer.

推荐答案

您需要在 $中指定 contentType: application / json .ajax 调用,因为当它们收到非 application / json POST正文时,CouchDB的某些配置会阻塞。

You need to specify contentType: "application/json" in your $.ajax call, as some configurations of CouchDB choke when they receive a non-application/json POST body.

这篇关于在本地实例中不支持ouchdb POST方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆