Skip to content

Commit

Permalink
Replace encodeURI with encodeURIComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
farshed committed Jan 17, 2021
1 parent e973267 commit ec8020b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Returns a promise that resolves to an object of type [song](#types). Returns `nu
### `searchSong(options)`

Accepts an [options](#types) object. <br/>
Returns a promise that resolves to an object of type [searchResult](#types). Returns `null` if no matches are found.
Returns a promise that resolves to an array of type [searchResult](#types). Returns `null` if no matches are found.

### `getSongById(id: (number | string))`

Expand Down
2 changes: 1 addition & 1 deletion lib/searchSong.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = async function (options) {
checkOptions(options);
let { apiKey, title, artist, optimizeQuery = false } = options;
const song = optimizeQuery ? getTitle(title, artist) : `${title} ${artist}`;
const reqUrl = `${searchUrl}${encodeURI(song)}`;
const reqUrl = `${searchUrl}${encodeURIComponent(song)}`;
const headers = {
Authorization: 'Bearer ' + apiKey
};
Expand Down

0 comments on commit ec8020b

Please sign in to comment.