I am trying to make a request to an API using the get
method in the https module.
Looking at HTTPS request in NodeJS, I've got a long way, but my request doesn't appear to include the query parameters…
Using the example from above, with my 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) {
Unless there's something sensitive in the request parameters, it is perfectly fine to send them as part of URL.
Yes. The entire text of an HTTPS session is secured by SSL. That includes the query and the headers.
According to https://nodejs.org/api/https.html#https_https_request_options_callback there is no option called "query". You need to include the query parameters to the "path".
Request path. Defaults to '/'. Should include query string if any. E.G. '/index.html?page=12'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With