New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@middy/http-response-serializer

Package Overview
Dependencies
Maintainers
10
Versions
197
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@middy/http-response-serializer - npm Package Compare versions

Comparing version 1.0.0-beta.5 to 1.0.0-beta.6

CHANGELOG.md

21

__tests__/index.js

@@ -255,2 +255,23 @@ const createError = require('http-errors')

})
test('It should return false when response body is falsey', async () => {
const handler = middy((event, context, cb) => {
cb(null, false)
})
const event = {
headers: {
Accept: 'text/plain'
}
}
handler.use(httpResponseSerializer(standardConfiguration))
const response = await invoke(handler, event)
expect(response).toEqual({
headers: {
'Content-Type': 'text/plain'
},
body: false
})
})
})

4

index.js

@@ -45,4 +45,4 @@ const Accept = require('accept')

// if the response is null or undefined, normalizes it back to an object
handler.response = handler.response || {}
// if the response is not an object, assign it to body. { body: undefined } is not serialized
handler.response = typeof handler.response === 'object' ? handler.response : { body: handler.response }

@@ -49,0 +49,0 @@ // set header

{
"name": "@middy/http-response-serializer",
"version": "1.0.0-beta.5",
"version": "1.0.0-beta.6",
"description": "The Http Serializer middleware lets you define serialization mechanisms based on the current content negotiation.",

@@ -53,6 +53,6 @@ "engines": {

"devDependencies": {
"@middy/core": "^1.0.0-beta.5",
"@middy/core": "^1.0.0-beta.6",
"es6-promisify": "^6.0.2"
},
"gitHead": "15f97b9e96fe0218d954d7190b16517909c8bdef"
"gitHead": "a9adee5afd272ddb20bff07c0576a7aa17f6e22c"
}
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