Comparing version 0.9.3 to 0.9.4
@@ -104,9 +104,11 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
} else { | ||
var args = Array.prototype.slice.call(arguments, 2); | ||
args.unshift(message); | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
debugLog.apply(debugLog, args); | ||
args[0] = componentName + ' ' + args[0]; | ||
if (args.length === 2 && typeof args[1] === 'object' && typeof args[1] !== null) { | ||
args[1].category = componentName; | ||
if (args.length === 2) { | ||
var meta = args[1]; | ||
if (typeof meta === 'object' && typeof meta !== null) { | ||
meta.category = componentName; | ||
} | ||
} | ||
@@ -113,0 +115,0 @@ _debug.apply(_logger, args); |
@@ -229,3 +229,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
RemoteHttpSyncProcedure.prototype._executeRequest = function(scope, url, headers, body, callback) { | ||
RemoteHttpSyncProcedure.prototype._executeRequest = function(scope, url, headers, json, callback) { | ||
var options = { | ||
@@ -238,5 +238,13 @@ url: url, | ||
var bodyIsSet = body !== undefined && body !== null; | ||
if (bodyIsSet) { | ||
options.json = body; | ||
var hasBody = json !== undefined && json !== null; | ||
if (hasBody) { | ||
var err; | ||
tryit(function() { | ||
options.body = JSON.stringify(json); | ||
}, function(exc) { | ||
err = exc; | ||
}); | ||
if (err) { | ||
return callback(err); | ||
} | ||
} | ||
@@ -257,4 +265,3 @@ | ||
meta.headers = headers; | ||
meta.body = bodyIsSet ? JSON.stringify(body) : null; | ||
meta.json = body || null; | ||
meta.body = options.body; | ||
meta.timeout = options.timeout; | ||
@@ -267,13 +274,3 @@ }, function(err) { | ||
} else { | ||
var trimmed = {}; | ||
if (scope.params) { | ||
_.extend(trimmed, scope.params); | ||
} | ||
trimmed.scopeUUID = scope.uuid; | ||
trimmed.scopeName = scope.name; | ||
trimmed.requestUUID = requestUUID; | ||
trimmed.url = url; | ||
trimmed.method = options.method; | ||
debug('Request trim meta', trimmed); | ||
debug('Request full meta', meta); | ||
debug('Request', meta); | ||
} | ||
@@ -285,9 +282,9 @@ }); | ||
var statusCode = response ? response.statusCode : null; | ||
var hasBody = body !== null && body !== undefined; | ||
body = hasBody ? JSON.stringify(body) : null; | ||
tryit(function() { | ||
var bodyIsSet = body !== null && body !== undefined; | ||
meta.headers = response ? (response.headers || {}) : {}; | ||
meta.statusCode = statusCode; | ||
meta.body = bodyIsSet ? JSON.stringify(body) : null; | ||
meta.json = body || null; | ||
meta.body = body; | ||
meta.durationMs = durationMs; | ||
@@ -303,15 +300,3 @@ if (err) { | ||
} else { | ||
var trimmed = {}; | ||
if (scope.params) { | ||
_.extend(trimmed, scope.params); | ||
} | ||
trimmed.scopeUUID = scope.uuid; | ||
trimmed.scopeName = scope.name; | ||
trimmed.requestUUID = requestUUID; | ||
trimmed.url = url; | ||
trimmed.method = options.method; | ||
trimmed.statusCode = statusCode; | ||
trimmed.durationMs = durationMs; | ||
debug('Response trim meta', trimmed); | ||
debug('Response full meta', meta); | ||
debug('Response', meta); | ||
} | ||
@@ -325,3 +310,3 @@ }); | ||
return callback(new Error( | ||
'Expected response 200 status code, received ' + response.statusCode + ' status code')); | ||
'Expected response 200 status code, received ' + statusCode + ' status code')); | ||
} | ||
@@ -328,0 +313,0 @@ |
{ | ||
"name": "jetstream", | ||
"version": "0.9.3", | ||
"version": "0.9.4", | ||
"description": "Jetstream Sync server framework to sync local and remote models", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -169,3 +169,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
assert.deepEqual(options.json, { | ||
assert.deepEqual(JSON.parse(options.body), { | ||
uuid: newMessageUUID, | ||
@@ -243,3 +243,3 @@ authorUUID: user.uuid, | ||
assert.deepEqual(options.json, { | ||
assert.deepEqual(JSON.parse(options.body), { | ||
uuid: user.uuid | ||
@@ -246,0 +246,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
503611
11259