Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rest-facade

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rest-facade - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

src/defaultOptions.js

2

package.json
{
"name": "rest-facade",
"version": "1.2.1",
"version": "1.2.2",
"description": "Simple abstraction for consuming REST API endpoints",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -166,1 +166,8 @@ # rest-facade [![Build Status](https://travis-ci.org/ngonzalvez/rest-facade.svg?branch=master)](https://travis-ci.org/ngonzalvez/rest-facade)

~~~
#### Arrays
By default, arrays in the querystring will be formmated this way: `?a=1&a=2&a=2`. However, you can change it to comma separated values `?a=1,2,3` by setting the `query.repeatParams` option to `false`.
~~~js
var client = new rest.Client(url, { query: { repeatParams: false }});
~~~

@@ -8,2 +8,3 @@ var extend = require('util')._extend;

var ArgumentError = require('./exceptions').ArgumentError;
var defaultOptions = require('./defaultOptions');

@@ -23,4 +24,3 @@

this.options = options || {};
this.options.query = this.options.query || { convertCase: null };
this.options = extend(defaultOptions, options);
this.url = url.parse(resourceUrl);

@@ -52,3 +52,3 @@ };

} else if (typeof arguments[0] === 'object') {
parmas = arguments[0];
params = arguments[0];
}

@@ -233,2 +233,3 @@

var newKey = null;
var value = null;

@@ -242,3 +243,12 @@ // If the user specified a convertion case (e.g. 'snakeCase') convert all the

newKey = convertCase(prevKey);
queryParams[newKey] = params[prevKey];
value = params[prevKey];
// If the repeatParams flag is set to false, encode arrays in
// the querystring as comma separated values.
// e.g. ?a=1,2,3
if (Array.isArray(value) && !this.options.query.repeatParams) {
value = value.join(',');
}
queryParams[newKey] = value;
}

@@ -245,0 +255,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc