From a177a9f85e2c8c8c3b60641c58da2aa9495eea1c Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Sat, 14 Dec 2013 08:30:55 +0200 Subject: [PATCH] Release 0.6.2. --- CHANGELOG.md | 3 +++ bower.json | 2 +- component.json | 2 +- exoskeleton.js | 21 ++++++++++++++++++++- lib/header.js | 2 +- package.json | 2 +- 6 files changed, 27 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5dd374..a9fd6cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# Exoskeleton 0.6.2 (14 December 2013) +* Added support for `data` option in `utils.ajax`. + # Exoskeleton 0.6.1 (9 December 2013) * Fixed handling of missing common.js jQuery dependency. diff --git a/bower.json b/bower.json index 4a3b726..9784a96 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "exoskeleton", "main": "exoskeleton.js", - "version": "0.6.1", + "version": "0.6.2", "homepage": "https://github.com/paulmillr/exoskeleton", "author": "Paul Miller (http://paulmillr.com)", "description": "Faster and leaner Backbone for your HTML5 apps.", diff --git a/component.json b/component.json index 05ab79c..cb56978 100644 --- a/component.json +++ b/component.json @@ -2,7 +2,7 @@ "name": "exoskeleton", "repo": "paulmillr/exoskeleton", "description": "Faster and leaner Backbone for your HTML5 apps.", - "version": "0.6.1", + "version": "0.6.2", "keywords": [ "Backbone", "Exoskeleton", diff --git a/exoskeleton.js b/exoskeleton.js index c79ea0f..6343f21 100644 --- a/exoskeleton.js +++ b/exoskeleton.js @@ -1,5 +1,5 @@ /*! - * Exoskeleton.js 0.6.1 + * Exoskeleton.js 0.6.2 * (c) 2013 Paul Miller * Based on Backbone.js * (c) 2010-2013 Jeremy Ashkenas, DocumentCloud @@ -419,6 +419,25 @@ utils.ajax = (function() { if (options.headers == null) options.headers = {}; options.headers['Content-Type'] = options.contentType; } + + // Stringify GET query params. + if (options.type === 'GET' && typeof options.data === 'object') { + var query = ''; + var stringifyKeyValuePair = function(key, value) { + return value == null ? '' : + '&' + encodeURIComponent(key) + + '=' + encodeURIComponent(value); + }; + for (var key in options.data) { + query += stringifyKeyValuePair(key, options.data[key]); + } + + if (query) { + var sep = (options.url.indexOf('?') === -1) ? '?' : '&'; + options.url += sep + query.substring(1); + } + } + if (options.credentials) options.withCredentials = true; xhr.addEventListener('readystatechange', end(xhr, options, deferred)); xhr.open(options.type, options.url, true); diff --git a/lib/header.js b/lib/header.js index 3c34ecf..de937d0 100644 --- a/lib/header.js +++ b/lib/header.js @@ -1,5 +1,5 @@ /*! - * Exoskeleton.js 0.6.1 + * Exoskeleton.js 0.6.2 * (c) 2013 Paul Miller * Based on Backbone.js * (c) 2010-2013 Jeremy Ashkenas, DocumentCloud diff --git a/package.json b/package.json index 1b7dc37..51ea370 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "exoskeleton", - "version": "0.6.1", + "version": "0.6.2", "description": "Faster and leaner Backbone for your HTML5 apps.", "main": "exoskeleton.js", "directories": {