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

ampersand-sync

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-sync - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

7

ampersand-sync.js

@@ -35,2 +35,9 @@ var _ = require('underscore');

// If passed a data param, we add it to the URL or body depending on request type
if (options.data && type === 'GET') {
// make sure we've got a '?'
params.url += _.contains(params.url, '?') ? '&' : '?';
params.url += qs.stringify(options.data);
}
// For older servers, emulate JSON by encoding the request into an HTML-form.

@@ -37,0 +44,0 @@ if (options.emulateJSON) {

2

package.json
{
"name": "ampersand-sync",
"description": "Standalone, modern-browser-only version of Backbone.Sync as Common JS module.",
"version": "1.0.2",
"version": "1.0.3",
"author": "Henrik Joreteg <henrik@andyet.net>",

@@ -6,0 +6,0 @@ "bugs": {

@@ -48,6 +48,9 @@ var test = require('tape');

test('passing data', function (t) {
// on reads it should be part of the URL
var xhr = sync('read', getStub(), {data: {a: 'a', one: 1}});
t.equal(xhr.ajaxSettings.url, '/library');
t.equal(xhr.ajaxSettings.data.a, 'a');
t.equal(xhr.ajaxSettings.data.one, 1);
t.equal(xhr.ajaxSettings.url, '/library?a=a&one=1', 'data passed to reads should be made into a query string');
var otherStub = getStub();
otherStub.url = '/library?something=hi';
var xhr2 = sync('read', otherStub, {data: {a: 'a', one: 1}});
t.equal(xhr2.ajaxSettings.url, '/library?something=hi&a=a&one=1', 'data passed to reads should be made into a query string');
t.end();

@@ -54,0 +57,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