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
11
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 to 1.1.0

26

__tests__/index.js

@@ -122,2 +122,28 @@ const createError = require('http-errors')

test('It should use the default when no matching accept preferences are found', async () => {
const handler = middy((event, context, cb) => {
event.preferredContentType = 'text/java'
cb(null, createHttpResponse())
})
handler.use(httpResponseSerializer(standardConfiguration))
const event = {
headers: {
Accept: 'application/java, text/x-dvi; q=0.8, text/x-c'
}
}
const response = await invoke(handler, event)
expect(response).toEqual({
statusCode: 200,
headers: {
'Content-Type': standardConfiguration.default
},
body: '{"message":"Hello World"}'
})
})
test('It should use `event.preferredContentType` instead of the default', async () => {

@@ -124,0 +150,0 @@ const handler = middy((event, context, cb) => {

2

index.js

@@ -40,3 +40,3 @@ const Accept = require('@hapi/accept')

// find in order of first preferred type that has a matching serializer
types.find(type => opts.serializers.map(s => {
types.find(type => opts.serializers.find(s => {
const test = s.regex.test(type)

@@ -43,0 +43,0 @@

{
"name": "@middy/http-response-serializer",
"version": "1.0.0",
"version": "1.1.0",
"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",
"@middy/core": "^1.1.0",
"es6-promisify": "^6.0.2"
},
"gitHead": "6d3b35f67dbfda8c8e7ae2885d267687181b2e1d"
"gitHead": "464119c7819be60f5dd85cce7648dd2db6723a55"
}
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