0
我正在使用类星体框架proyect和名为的产品的couchdb数据库。405方法不允许从javascript获取couchdb文档
我尝试是让GET请求到某个文档,但我有以下错误:
错误
:8080/#/:1 XMLHttpRequest cannot load http://localhost:5984/product. Response for preflight has invalid HTTP status code 405
vue-resource.es2015.js?fc90:1085 OPTIONS http://localhost:5984/product 405 (Method Not Allowed)
Index.vue
getProyect() {
var deferred = Q.defer()
var url = "http://localhost:5984/product/product1"
Vue.http.get(url)
.then(
function (response) {
deferred.resolve(response.data)
console.log("success getting response")
},
function (error) {
var msg = 'N/A'
console.log('ERROR get:', error)
deferred.reject(msg)
}
)
return deferred.promise
}
-Doing通过邮递员相同的请求正常工作。
您可以使用curl看到CORS配置:
curl -X GET admin:[email protected]:5984/_config/cors
//Output
{"credentials":"true","origins":"*","headers":"accept, authorization, content-type, origin, referer, x-csrf-token","methods":"GET, PUT, POST, HEAD, DELETE, OPTIONS"}
我也有允许couchdb
服务器上CORS的问题,并通过编辑local.ini解决了这个问题,但是这一次不知道如何解决它。任何帮助将不胜感激。