How to use the querystring.stringify function in querystring

To help you get started, we’ve selected a few querystring examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gbif / portal16 / app / controllers / api / charts / occurrenceCharts.ctrl.js View on Github external
async function getData(query) {
    let options = {
        url: apiConfig.occurrenceSearch.url + '?' + querystring.stringify(query),
        method: 'GET',
        fullResponse: true,
        json: true
    };
    let response = await request(options);
    if (response.statusCode !== 200) {
        // TODO log error
        throw 'Internal server error getting data';
    }
    return response.body;
}
github hsiW / WishBot / commands.js View on Github external
function get_gif(tags, func) {
	var params = {"api_key": "dc6zaTOxFJmzC", "rating": "r", "format": "json","limit": 1 };
	var query = qs.stringify(params);
	if (tags !== null) {query += "&tag=" + tags.join('+')}
	var request = require("request");
	request("http://api.giphy.com/v1/gifs/random?" + query, function (error, response, body) {
		if (error || response.statusCode !== 200) {bot.sendMessage(msg, "There was an error getting a gif");console.log(errorC(error));}
		else {var responseObj = JSON.parse(body); func(responseObj.data.id);}
	}.bind(this));
}
github bzarras / newsapi / src / index.js View on Github external
function createUrlFromEndpointAndOptions (endpoint, options) {
  const query = qs.stringify(options);
  const baseURL = `${host}${endpoint}`;
  return query ? `${baseURL}?${query}` : baseURL;
}
github proxycrawl / proxycrawl-node / src / proxycrawl-api.js View on Github external
post(url, data, options = {}) {
    options.method = options.method || 'POST';
    if ('object' === typeof data && undefined !== options.postType && 'json' === options.postType) {
      data = JSON.stringify(data);
      options.postContentType = options.postContentType || 'application/json';
    } else if ('object' === typeof data) {
      data = querystring.stringify(data);
    }
    options.postData = data;
    return this.request(url, options);
  }
github bitbankinc / node-bitbankcc / src / lib / private-api.ts View on Github external
get(path: string, query?: {}) {
    let params = '';
    if (query && Object.keys(query).length) {
      params += '?' + querystring.stringify(query);
    }
    const headers = this.makeHeader('/v1'.concat(path, params));
    return super.get(path, query, headers);
  }
github CelsiusNetwork / celsius-js-sdk / lib / http-client.js View on Github external
get: function (path, queryParams, userSecret) {
      const headers = _getHeaders({ userSecret })
      queryParams = querystring.stringify(queryParams)
      return _dispatchAxiosRequest('GET', path + '?' + queryParams, headers, null)
    },
github kythe / kythe / kythe / typescript / languageserver / languageserver / src / pathContext.ts View on Github external
export function ticketString({corpus, ...params}: KytheTicket) {
  if (params.root === '') delete params.root;
  return `kythe://${corpus}?` + stringify(params, '?') as KytheTicketString;
}
github Esri / sonar / lib / webmap_url.js View on Github external
module.exports = function webmapUrl(location, params) {
  if(params === undefined)
    params = {}


  var url = "https://www.arcgis.com/home/webmap/viewer.html"
  if(params.marker === undefined || params.marker === null) {
    params.marker = location.x + ";" + location.y + ";;Ping;;Ping";
  }
  if(params.level === undefined || params.level === null) {
    params.level = 16;
  }

  return url + "?" + qs.stringify(params);
}
github jsforce / jsforce / lib / oauth2.js View on Github external
getAuthorizationUrl : function(params) {
    params = _.extend({
      response_type : "code",
      client_id : this.clientId,
      redirect_uri : this.redirectUri
    }, params || {});
    return this.authzServiceUrl +
      (this.authzServiceUrl.indexOf('?') >= 0 ? "&" : "?") +
      querystring.stringify(params);
  },

querystring

Node's querystring module for all engines.

MIT
Latest version published 4 years ago

Package Health Score

55 / 100
Full package analysis