我正在尝试使用https模块中的get方法向API发出请求. 看看HTTPS request in NodeJS,我有很长的路要走,但我的请求似乎没有包含查询参数…… 使用上面的例子,我的mods: var $q = require('q'), _ = req
看看HTTPS request in NodeJS,我有很长的路要走,但我的请求似乎没有包含查询参数……
使用上面的例子,我的mods:
var $q = require('q'), _ = require('lodash'), path = require('path'), Qs = require('qs'), path = require('path'), uuid = require('node-uuid'), https = require('https'); var params = { schema: '1.0', form: 'json', username: 'name' } var options = { host: 'openshift.redhat.com', port: 443, path: '/broker/rest/api', query: params }; var req = https.get(options, function(res) {根据 https://nodejs.org/api/https.html#https_https_request_options_callback,没有称为“查询”的选项.您需要将查询参数包含在“路径”中.
Request path. Defaults to ‘/’. Should include query string if any. E.G. ‘/index.html?page=12’.