Comparing version 0.1.18 to 0.1.19
@@ -49,2 +49,3 @@ // Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved. | ||
* a 500ms wait. | ||
* - noContentMD5: skip content-md5 checking. | ||
* | ||
@@ -93,2 +94,3 @@ * | ||
} | ||
this.noContentMD5 = options.noContentMD5; | ||
@@ -337,2 +339,4 @@ if (log.trace()) { | ||
if (res.body.length !== len) { | ||
log.trace('RestClient: %s %s, content-length mismatch', | ||
options.method, options.path); | ||
if (operation.retry(new Error())) return; | ||
@@ -345,3 +349,2 @@ | ||
res.body.length, | ||
details: res.headers | ||
})); | ||
@@ -351,8 +354,14 @@ } | ||
if (res.headers['content-md5']) { | ||
if (res.headers['content-md5'] && !self.noContentMD5) { | ||
var hash = crypto.createHash('md5'); | ||
hash.update(res.body); | ||
if (res.headers['content-md5'] !== hash.digest('base64')) { | ||
var digest = hash.digest('base64'); | ||
if (res.headers['content-md5'] !== digest) { | ||
log.trace('RestClient: %s %s, content-md5 mismatch', | ||
options.method, options.path); | ||
err = newError({ | ||
details: 'Content-MD5 mismatch' | ||
httpCode: HttpCodes.InternalError, | ||
restCode: RestCodes.InvalidHeader, | ||
message: 'Content-MD5 ' + res.headers['content-md5'] + | ||
' didn\'t match: ' + digest | ||
}); | ||
@@ -390,2 +399,4 @@ if (operation.retry(err)) return; | ||
log.trace('RestClient: %s %s: issuing callback', | ||
options.method, options.path); | ||
callback(null, res.statusCode, res.headers, res.params, res); | ||
@@ -442,3 +453,8 @@ }); | ||
} else { | ||
var headers = opts.headers; | ||
opts._restify_extend(options); | ||
opts.headers = headers; | ||
if (options.headers) { | ||
opts.headers._restify_extend(options.headers); | ||
} | ||
} | ||
@@ -445,0 +461,0 @@ } |
// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved. | ||
module.exports = { | ||
InternalError: 'InternalError', | ||
InvalidArgument: 'InvalidArgument', | ||
@@ -5,0 +6,0 @@ InvalidCredentials: 'InvalidCredentials', |
{ | ||
"name": "restify", | ||
"description": "REST framework specifically meant for web service APIs", | ||
"version": "0.1.18", | ||
"version": "0.1.19", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
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
138271
2912