#911 support params option in Parse.Cloud.httpRequest
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
var request = require("request"),
|
||||
querystring = require('querystring'),
|
||||
Parse = require('parse/node').Parse;
|
||||
|
||||
var encodeBody = function(body, headers = {}) {
|
||||
@@ -34,7 +35,13 @@ module.exports = function(options) {
|
||||
options.body = encodeBody(options.body, options.headers);
|
||||
// set follow redirects to false by default
|
||||
options.followRedirect = options.followRedirects == true;
|
||||
|
||||
// support params options
|
||||
if (typeof options.params === 'object') {
|
||||
options.qs = options.params;
|
||||
} else if (typeof options.params === 'string') {
|
||||
options.qs = querystring.parse(options.params);
|
||||
}
|
||||
|
||||
request(options, (error, response, body) => {
|
||||
if (error) {
|
||||
if (callbacks.error) {
|
||||
|
||||
Reference in New Issue
Block a user