Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Use querystring to encode search queries #3

Merged
merged 1 commit into from

2 participants

@carlptr

Thanks for this fine API. I have used and found it useful. I noticed that then using query containing special characters like & I received errors.
The proposed change fixes this by using node's querystring api to encode the search query.

@peol peol merged commit 12d215e into peol:master
@peol
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 20, 2012
  1. use querystring api to encode search queries

    Patrick Carl authored
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/spotify/Spotify.js
View
5 lib/spotify/Spotify.js
@@ -1,4 +1,5 @@
-var http = require('http');
+var http = require('http'),
+ querystring = require('querystring');
/**
* Internal method for creating response hollabacks, should not be used on
@@ -57,7 +58,7 @@ module.exports = {
* @param {Function} The hollaback that'll be invoked once there's data
*/
search: function(opts, hollaback) {
- var query = '/search/1/'+opts.type+'.json?q='+opts.query;
+ var query = '/search/1/'+opts.type+'.json?' + querystring.stringify({q: opts.query});
this.get(query, hollaback);
},
Something went wrong with that request. Please try again.