0
任何想法爲什麼此請求在nodejs
中失敗,因爲它使用curl
?也許我沒有正確地映射請求。使用nodejs發出https請求失敗,但使用curl
使用請求curl
CLI:
curl -u myusername:mypassword https://db.com/dbname/_all_docs
響應,在DB中的文件:
{
rows: [
..
]
}
使用https
模塊請求在nodejs
:
var requestOptions = {
host: 'db.com',
path: 'dbname/_all_docs',
method: 'GET',
auth: 'myusername:mypassword'
};
響應代碼是502
:
{"error":"bad_gateway","reason":"Bad gateway"}