@lwrjs/security 0.10.0-alpha.16 → 0.10.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/cjs/wrapper.cjs
CHANGED
|
@@ -35,7 +35,10 @@ function isViewDefinitionResponse(response) {
|
|
|
35
35
|
}
|
|
36
36
|
function secure(routeHandler, options) {
|
|
37
37
|
return async (request, context) => {
|
|
38
|
-
|
|
38
|
+
let routeHandlerResponse = routeHandler(request, context);
|
|
39
|
+
if (routeHandlerResponse instanceof Promise) {
|
|
40
|
+
routeHandlerResponse = await routeHandlerResponse;
|
|
41
|
+
}
|
|
39
42
|
if (isViewResponse(routeHandlerResponse)) {
|
|
40
43
|
if (!routeHandlerResponse.headers || !routeHandlerResponse.headers["content-type"].startsWith("text/html")) {
|
|
41
44
|
return routeHandlerResponse;
|
package/build/es/wrapper.js
CHANGED
|
@@ -18,8 +18,10 @@ function isViewDefinitionResponse(response) {
|
|
|
18
18
|
*/
|
|
19
19
|
export function secure(routeHandler, options) {
|
|
20
20
|
return async (request, context) => {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
let routeHandlerResponse = routeHandler(request, context);
|
|
22
|
+
if (routeHandlerResponse instanceof Promise) {
|
|
23
|
+
routeHandlerResponse = await routeHandlerResponse;
|
|
24
|
+
}
|
|
23
25
|
if (isViewResponse(routeHandlerResponse)) {
|
|
24
26
|
// only apply headers when the view response is html
|
|
25
27
|
if (!routeHandlerResponse.headers ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lwrjs/security",
|
|
3
|
-
"version": "0.10.0-alpha.
|
|
3
|
+
"version": "0.10.0-alpha.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "build/es/index.d.ts",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"build/**/*.d.ts"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@lwrjs/shared-utils": "0.10.0-alpha.
|
|
32
|
+
"@lwrjs/shared-utils": "0.10.0-alpha.17"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@lwrjs/types": "0.10.0-alpha.
|
|
35
|
+
"@lwrjs/types": "0.10.0-alpha.17"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=16.0.0 <20"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "36cfce3a18bf3dc71a7d5203bbaa9aa752ccce06"
|
|
41
41
|
}
|