Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

restify

Package Overview
Dependencies
Maintainers
11
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restify - npm Package Compare versions

Comparing version 8.4.0 to 8.4.1

4

CHANGELOG.md

@@ -0,1 +1,5 @@

<a name="8.4.1"></a>
### 8.4.1 (2019-11-27)
<a name="8.4.0"></a>

@@ -2,0 +6,0 @@ ## 8.4.0 (2019-07-31)

@@ -5,2 +5,4 @@ // Copyright 2012 Mark Cavage, Inc. All rights reserved.

var errors = require('restify-errors');
///--- Exports

@@ -20,3 +22,14 @@

function formatJSON(req, res, body) {
var data = body ? JSON.stringify(body) : 'null';
var data = 'null';
if (body) {
try {
data = JSON.stringify(body);
} catch (e) {
throw new errors.InternalServerError(
{ cause: e, info: { formatter: 'json' } },
'could not format response body'
);
}
}
// Setting the content-length header is not a formatting feature and should

@@ -23,0 +36,0 @@ // be separated into another module

@@ -497,2 +497,4 @@ // Copyright 2012 Mark Cavage, Inc. All rights reserved.

var formatterType = type;
if (self._charSet) {

@@ -510,3 +512,22 @@ type = type + '; charset=' + self._charSet;

return flush(self, formatter(self.req, self, body));
var formattedBody;
try {
formattedBody = formatter(self.req, self, body);
} catch (e) {
if (
e instanceof errors.RestError ||
e instanceof errors.HttpError
) {
var res = formatterError(
self,
e,
'error in formatter (' +
formatterType +
') formatting response body'
);
return res;
}
throw e;
}
return flush(self, formattedBody);
}

@@ -878,5 +899,6 @@ }

* @param {Error} err - error
* @param {String} [msg] - custom log message
* @returns {Response} response
*/
function formatterError(res, err) {
function formatterError(res, err, msg) {
// If the user provided a non-success error code, we don't want to

@@ -889,2 +911,6 @@ // mess with it since their error is probably more important than

if (typeof msg !== 'string') {
msg = 'error retrieving formatter';
}
res.log.warn(

@@ -895,3 +921,3 @@ {

},
'error retrieving formatter'
msg
);

@@ -898,0 +924,0 @@

3

package.json

@@ -77,3 +77,3 @@ {

],
"version": "8.4.0",
"version": "8.4.1",
"repository": {

@@ -145,2 +145,3 @@ "type": "git",

"rimraf": "^2.6.3",
"sinon": "^7.5.0",
"validator": "^7.2.0",

@@ -147,0 +148,0 @@ "watershed": "^0.4.0"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc