Skip to content

Commit

Permalink
added # char to encoding list and enhanced char-test unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenlb committed Oct 3, 2013
1 parent bb908f7 commit d023d6f
Show file tree
Hide file tree
Showing 21 changed files with 265 additions and 235 deletions.
10 changes: 6 additions & 4 deletions core/pubnub-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ function build_url( url_components, url_params ) {
if (!url_params) return url;

each( url_params, function( key, value ) {
(typeof value != 'undefined' && value != null && encode_param(value).length > 0) && params.push(key + "=" + encode_param(value));
(typeof value != 'undefined' &&
value != null && encode_param(value).length > 0
) && params.push(key + "=" + encode_param(value));
} );

url += "?" + params.join(PARAMSBIT);
Expand Down Expand Up @@ -166,11 +168,11 @@ function encode_base( path, chars ) {
}

function encode( path, chars ) {
return encode_base( path, chars || "?/%&" );
return encode_base( path, chars || '?/%&#' );
}

function encode_param(value) {
return encode_base( value, "?/%&" );
return encode_base( value, '?/%&#' );
}

/**
Expand Down Expand Up @@ -437,7 +439,7 @@ function PN_API(setup) {
STD_ORIGIN, 'publish',
PUBLISH_KEY, SUBSCRIBE_KEY,
0, encode(channel),
jsonp, encode( msg, "?%&" )
jsonp, encode(msg)
];

// Queue Message Send
Expand Down
10 changes: 6 additions & 4 deletions modern/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ function build_url( url_components, url_params ) {
if (!url_params) return url;

each( url_params, function( key, value ) {
(typeof value != 'undefined' && value != null && encode_param(value).length > 0) && params.push(key + "=" + encode_param(value));
(typeof value != 'undefined' &&
value != null && encode_param(value).length > 0
) && params.push(key + "=" + encode_param(value));
} );

url += "?" + params.join(PARAMSBIT);
Expand Down Expand Up @@ -167,11 +169,11 @@ function encode_base( path, chars ) {
}

function encode( path, chars ) {
return encode_base( path, chars || "?/%&" );
return encode_base( path, chars || '?/%&#' );
}

function encode_param(value) {
return encode_base( value, "?/%&" );
return encode_base( value, '?/%&#' );
}

/**
Expand Down Expand Up @@ -438,7 +440,7 @@ function PN_API(setup) {
STD_ORIGIN, 'publish',
PUBLISH_KEY, SUBSCRIBE_KEY,
0, encode(channel),
jsonp, encode( msg, "?%&" )
jsonp, encode(msg)
];

// Queue Message Send
Expand Down
50 changes: 25 additions & 25 deletions modern/pubnub.min.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions node.js/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ function build_url( url_components, url_params ) {
if (!url_params) return url;

each( url_params, function( key, value ) {
(typeof value != 'undefined' && value != null && encode_param(value).length > 0) && params.push(key + "=" + encode_param(value));
(typeof value != 'undefined' &&
value != null && encode_param(value).length > 0
) && params.push(key + "=" + encode_param(value));
} );

url += "?" + params.join(PARAMSBIT);
Expand Down Expand Up @@ -167,11 +169,11 @@ function encode_base( path, chars ) {
}

function encode( path, chars ) {
return encode_base( path, chars || "?/%&" );
return encode_base( path, chars || '?/%&#' );
}

function encode_param(value) {
return encode_base( value, "?/%&" );
return encode_base( value, '?/%&#' );
}

/**
Expand Down Expand Up @@ -438,7 +440,7 @@ function PN_API(setup) {
STD_ORIGIN, 'publish',
PUBLISH_KEY, SUBSCRIBE_KEY,
0, encode(channel),
jsonp, encode( msg, "?%&" )
jsonp, encode(msg)
];

// Queue Message Send
Expand Down
10 changes: 6 additions & 4 deletions phonegap/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ function build_url( url_components, url_params ) {
if (!url_params) return url;

each( url_params, function( key, value ) {
(typeof value != 'undefined' && value != null && encode_param(value).length > 0) && params.push(key + "=" + encode_param(value));
(typeof value != 'undefined' &&
value != null && encode_param(value).length > 0
) && params.push(key + "=" + encode_param(value));
} );

url += "?" + params.join(PARAMSBIT);
Expand Down Expand Up @@ -167,11 +169,11 @@ function encode_base( path, chars ) {
}

function encode( path, chars ) {
return encode_base( path, chars || "?/%&" );
return encode_base( path, chars || '?/%&#' );
}

function encode_param(value) {
return encode_base( value, "?/%&" );
return encode_base( value, '?/%&#' );
}

/**
Expand Down Expand Up @@ -438,7 +440,7 @@ function PN_API(setup) {
STD_ORIGIN, 'publish',
PUBLISH_KEY, SUBSCRIBE_KEY,
0, encode(channel),
jsonp, encode( msg, "?%&" )
jsonp, encode(msg)
];

// Queue Message Send
Expand Down
50 changes: 25 additions & 25 deletions phonegap/pubnub.min.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions sencha/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ function build_url( url_components, url_params ) {
if (!url_params) return url;

each( url_params, function( key, value ) {
(typeof value != 'undefined' && value != null && encode_param(value).length > 0) && params.push(key + "=" + encode_param(value));
(typeof value != 'undefined' &&
value != null && encode_param(value).length > 0
) && params.push(key + "=" + encode_param(value));
} );

url += "?" + params.join(PARAMSBIT);
Expand Down Expand Up @@ -167,11 +169,11 @@ function encode_base( path, chars ) {
}

function encode( path, chars ) {
return encode_base( path, chars || "?/%&" );
return encode_base( path, chars || '?/%&#' );
}

function encode_param(value) {
return encode_base( value, "?/%&" );
return encode_base( value, '?/%&#' );
}

/**
Expand Down Expand Up @@ -438,7 +440,7 @@ function PN_API(setup) {
STD_ORIGIN, 'publish',
PUBLISH_KEY, SUBSCRIBE_KEY,
0, encode(channel),
jsonp, encode( msg, "?%&" )
jsonp, encode(msg)
];

// Queue Message Send
Expand Down

0 comments on commit d023d6f

Please sign in to comment.