Skip to content

Commit

Permalink
Fix for #241
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <[email protected]>
  • Loading branch information
derekcollison committed Dec 10, 2018
1 parent 43e2aca commit f378fe6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions lib/nats.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var net = require('net'),
/**
* Constants
*/
var VERSION = '1.2.0',
var VERSION = '1.2.1',

DEFAULT_PORT = 4222,
DEFAULT_PRE = 'nats://localhost:',
Expand Down Expand Up @@ -369,16 +369,16 @@ Client.prototype.parseOptions = function(opts) {
}
};

function sanitizeUrl(url) {
if ((/^.*:\/\/.*/).exec(url) === null) {
// Does not have a scheme.
url = 'nats://' + url;
}
var u = new URL(url);
function sanitizeUrl(urlstr) {
if ((/^.*:\/\/.*/).exec(urlstr) === null) {
// Does not have a scheme.
url = 'nats://' + url;
}
var u = url.parse(urlstr);
if (u.port === '') {
u.port = DEFAULT_PORT;
u.port = DEFAULT_PORT.toString();
}
return u.toString();
return url.format(u);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nats",
"version": "1.2.0",
"version": "1.2.1",
"description": "Node.js client for NATS, a lightweight, high-performance cloud native messaging system",
"keywords": [
"nats",
Expand Down

0 comments on commit f378fe6

Please sign in to comment.