Comparing version 3.1.6 to 3.1.7
{ | ||
"name": "pubnub", | ||
"preferGlobal": false, | ||
"version": "3.1.6", | ||
"version": "3.1.7", | ||
"author": "Pubnub <stephen@pubnub.com>", | ||
@@ -6,0 +6,0 @@ "description": "Publish & Subscribe Real-time Messaging with PubNub", |
@@ -108,2 +108,3 @@ /* --------------------------------------------------------------------------- | ||
, failed = 0 | ||
, body = '' | ||
, fail = function(e) { | ||
@@ -113,25 +114,23 @@ if (failed) return; | ||
(setup.fail||function(){})(e); | ||
}, body = '' | ||
, client = http.createClient( 80, origin, ssl ) | ||
, request = client.request( 'GET', url, { 'host': origin }); | ||
}; | ||
request.end(); | ||
request.on( 'error', fail ); | ||
request.on( 'response', function (response) { | ||
response.setEncoding('utf8'); | ||
response.on( 'error', fail ); | ||
response.on( 'data', function (chunk) { | ||
if (chunk) body += chunk; | ||
} ); | ||
response.on( 'end', function () { | ||
try { | ||
if (body) return success(JSON.parse(body)); | ||
else fail(); | ||
} | ||
catch(e) { | ||
fail(); | ||
} | ||
} ); | ||
} ); | ||
try { | ||
http.get( { | ||
host : origin, | ||
port : ssl ? 443 : 80, | ||
path : url | ||
}, function(response) { | ||
response.setEncoding('utf8'); | ||
response.on( 'error', fail ); | ||
response.on( 'data', function (chunk) { | ||
if (chunk) body += chunk; | ||
} ); | ||
response.on( 'end', function () { | ||
try { | ||
if (body) return success(JSON.parse(body)); | ||
else fail(); | ||
} catch(e) { fail(); } | ||
} ); | ||
}).on( 'error', fail ); | ||
} catch(e) { fail(); } | ||
} | ||
@@ -138,0 +137,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21504