Commit d519201c authored by Aaron Tidwell's avatar Aaron Tidwell Committed by GitHub

Release 2.1.2 (#38)

* escape all qs params (#37)

* build 2.1.2 and run docs
parent d939f8de
### 2.1.2
- Force escaping of all url params (#34)
### 2.1.1 ### 2.1.1
- Fix bug preventing match_id and participant_id passed as underscore properties for URL generation #32 - Fix bug preventing match_id and participant_id passed as underscore properties for URL generation (#32)
### 2.1.0 ### 2.1.0
- Fix null values being returned as empty objects (#24) - Fix null values being returned as empty objects (#24)
......
...@@ -383,7 +383,7 @@ const client = challonge.createClient({ ...@@ -383,7 +383,7 @@ const client = challonge.createClient({
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -945,7 +945,7 @@ ...@@ -945,7 +945,7 @@
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -1645,7 +1645,7 @@ ...@@ -1645,7 +1645,7 @@
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -2356,7 +2356,7 @@ ...@@ -2356,7 +2356,7 @@
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -131,11 +131,10 @@ Client.prototype.makeRequest = function(obj) { ...@@ -131,11 +131,10 @@ Client.prototype.makeRequest = function(obj) {
const serialized = util.serializeToQSParams(obj); const serialized = util.serializeToQSParams(obj);
path = versionPaths[this.options.get('version')] + (path ? path : '') + '.' + this.options.get('format') + '?' + serialized; path = versionPaths[this.options.get('version')] + (path ? path : '') + '.' + this.options.get('format') + '?' + serialized;
// create options for the https call // create options for the https call
const options = { const options = {
hostname: 'api.challonge.com', hostname: 'api.challonge.com',
path: path, path: encodeURI(path),
method: method, method: method,
headers: { headers: {
'Content-Length': 0 // server throws nginx error without a content-length 'Content-Length': 0 // server throws nginx error without a content-length
...@@ -180,7 +179,7 @@ Client.prototype.makeRequest = function(obj) { ...@@ -180,7 +179,7 @@ Client.prototype.makeRequest = function(obj) {
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -120,7 +120,7 @@ exports.handle = function(res, resData, callback, format) { ...@@ -120,7 +120,7 @@ exports.handle = function(res, resData, callback, format) {
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -160,7 +160,7 @@ Matches.prototype.update = function(obj) { ...@@ -160,7 +160,7 @@ Matches.prototype.update = function(obj) {
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -249,7 +249,7 @@ Participants.prototype.randomize = function(obj) { ...@@ -249,7 +249,7 @@ Participants.prototype.randomize = function(obj) {
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -361,7 +361,7 @@ Tournaments.prototype.abortCheckIn = function(obj) { ...@@ -361,7 +361,7 @@ Tournaments.prototype.abortCheckIn = function(obj) {
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -89,7 +89,7 @@ exports.createClient = function createClient(options) { ...@@ -89,7 +89,7 @@ exports.createClient = function createClient(options) {
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -450,7 +450,7 @@ const client = challonge.createClient({ ...@@ -450,7 +450,7 @@ const client = challonge.createClient({
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -103,7 +103,7 @@ client.tournaments.create({ ...@@ -103,7 +103,7 @@ client.tournaments.create({
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -366,7 +366,7 @@ ...@@ -366,7 +366,7 @@
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -857,7 +857,7 @@ ...@@ -857,7 +857,7 @@
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -107,7 +107,7 @@ module.exports = serialize; ...@@ -107,7 +107,7 @@ module.exports = serialize;
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -121,7 +121,7 @@ module.exports = { ...@@ -121,7 +121,7 @@ module.exports = {
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Sat May 05 2018 17:05:04 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Jul 09 2018 17:18:03 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer> </footer>
<script>prettyPrint();</script> <script>prettyPrint();</script>
......
...@@ -92,11 +92,10 @@ Client.prototype.makeRequest = function(obj) { ...@@ -92,11 +92,10 @@ Client.prototype.makeRequest = function(obj) {
const serialized = util.serializeToQSParams(obj); const serialized = util.serializeToQSParams(obj);
path = versionPaths[this.options.get('version')] + (path ? path : '') + '.' + this.options.get('format') + '?' + serialized; path = versionPaths[this.options.get('version')] + (path ? path : '') + '.' + this.options.get('format') + '?' + serialized;
// create options for the https call // create options for the https call
const options = { const options = {
hostname: 'api.challonge.com', hostname: 'api.challonge.com',
path: path, path: encodeURI(path),
method: method, method: method,
headers: { headers: {
'Content-Length': 0 // server throws nginx error without a content-length 'Content-Length': 0 // server throws nginx error without a content-length
......
...@@ -215,7 +215,26 @@ describe('Client Class', () => { ...@@ -215,7 +215,26 @@ describe('Client Class', () => {
expect(httpsMock.opts).toEqual({ expect(httpsMock.opts).toEqual({
hostname: 'api.challonge.com', hostname: 'api.challonge.com',
path: '/v1/tournaments/some/path.json?randomprop=thingie&some_property[another_property]=anotherthing&api_key=mykey&cache_bust=1', path: '/v1/tournaments/some/path.json?randomprop=thingie&some_property%5Banother_property%5D=anotherthing&api_key=mykey&cache_bust=1',
method: 'GET',
headers: {
'Content-Length': 0
}
});
});
it('should make a request with escaped data for extended characters', () => {
spyOn(Math, 'random').and.returnValue(1);
client.options.apiKey = 'mykey';
client.makeRequest({
path: '/some/path',
method: 'GET',
randomprop: '扶摇ståleSÓLO独播'
});
expect(httpsMock.opts).toEqual({
hostname: 'api.challonge.com',
path: '/v1/tournaments/some/path.json?randomprop=%E6%89%B6%E6%91%87st%C3%A5leS%C3%93LO%E7%8B%AC%E6%92%AD&api_key=mykey&cache_bust=1',
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Length': 0 'Content-Length': 0
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"description": "Wrapper for the challong api", "description": "Wrapper for the challong api",
"author": "Aaron Tiwell <aaron.tidwell@gmail.com>", "author": "Aaron Tiwell <aaron.tidwell@gmail.com>",
"main": "./lib/challonge.js", "main": "./lib/challonge.js",
"version": "2.1.1", "version": "2.1.2",
"contributors": [ "contributors": [
{ {
"name": "Ricardo Reis", "name": "Ricardo Reis",
......
...@@ -6,7 +6,7 @@ var client = challonge.createClient({ ...@@ -6,7 +6,7 @@ var client = challonge.createClient({
version: 1, version: 1,
}); });
var tourneyName = 'new_api_test' + Math.floor(Math.random()*10000); var tourneyName = 'new_api_test扶摇ståleSÓLO独播' + Math.floor(Math.random()*10000);
client.tournaments.create({ client.tournaments.create({
tournament: { tournament: {
...@@ -31,7 +31,7 @@ function update() { ...@@ -31,7 +31,7 @@ function update() {
url: tourneyName, url: tourneyName,
signupCap: 16, signupCap: 16,
tournamentType: 'double elimination', tournamentType: 'double elimination',
description: 'some new description', description: 'some new description扶摇ståleSÓLO独播',
acceptAttachments: true acceptAttachments: true
}, },
...@@ -39,7 +39,7 @@ function update() { ...@@ -39,7 +39,7 @@ function update() {
if (err) { console.log(err); return; } if (err) { console.log(err); return; }
console.log(data); console.log(data);
pcreate('player1'); pcreate('player1扶摇ståleSÓLO独播');
} }
}); });
} }
...@@ -53,7 +53,7 @@ function pcreate(name) { ...@@ -53,7 +53,7 @@ function pcreate(name) {
callback: function(err,data){ callback: function(err,data){
if (err) { console.log(err); return; } if (err) { console.log(err); return; }
console.log(data); console.log(data);
if (name === 'player1') { if (name === 'player1扶摇ståleSÓLO独播') {
pcreate('player2'); pcreate('player2');
} else { } else {
start(); start();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment