@middy/http-security-headers
Advanced tools
Comparing version 2.0.0-alpha.0 to 2.0.0-alpha.1
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
// Code and Defaults heavily based off https://helmetjs.github.io/ | ||
@@ -128,7 +130,9 @@ const defaults = { | ||
const httpSecurityHeadersMiddlewareAfter = async handler => { | ||
handler.response = handler.response ?? { | ||
var _handler$response, _handler$response$hea, _handler$response2; | ||
handler.response = (_handler$response = handler.response) !== null && _handler$response !== void 0 ? _handler$response : { | ||
statusCode: 500 | ||
}; // catch thrown errors, prevent default statusCode | ||
handler.response.headers = handler.response?.headers ?? {}; | ||
handler.response.headers = (_handler$response$hea = (_handler$response2 = handler.response) === null || _handler$response2 === void 0 ? void 0 : _handler$response2.headers) !== null && _handler$response$hea !== void 0 ? _handler$response$hea : {}; | ||
Object.keys(helmet).forEach(key => { | ||
@@ -135,0 +139,0 @@ const config = { ...defaults[key], |
{ | ||
"name": "@middy/http-security-headers", | ||
"version": "2.0.0-alpha.0", | ||
"version": "2.0.0-alpha.1", | ||
"description": "Applies best practice security headers to responses. It's a simplified port of HelmetJS", | ||
@@ -15,2 +15,3 @@ "type": "commonjs", | ||
"types": "index.d.ts", | ||
"files": [], | ||
"scripts": { | ||
@@ -50,3 +51,3 @@ "test": "npm run test:typings && npm run test:unit", | ||
"homepage": "https://github.com/middyjs/middy#readme", | ||
"gitHead": "e047c0d3db00aa11b39f2d3e193458ea021a58a0" | ||
"gitHead": "f8b0f418477cdbff47da693963bf1ea918b39d04" | ||
} |
9888
4
127