@middy/http-event-normalizer 5.0.0-rc.0 → 5.0.1
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/index.js +0 -13
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -2,14 +2,6 @@ const httpEventNormalizerMiddleware = ()=>{
|
|
|
2
2
|
const httpEventNormalizerMiddlewareBefore = async (request)=>{
|
|
3
3
|
const { event } = request;
|
|
4
4
|
const version = pickVersion(event);
|
|
5
|
-
const isHttpEvent = isVersionHttpEvent[version]?.(event);
|
|
6
|
-
if (!isHttpEvent) {
|
|
7
|
-
throw new Error('Unknown http event format', {
|
|
8
|
-
cause: {
|
|
9
|
-
package: '@middy/http-event-normalizer'
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
5
|
// VPC Lattice is an http event, however uses a different notation
|
|
14
6
|
// - query_string_parameters
|
|
15
7
|
// - is_base64_encoded
|
|
@@ -31,10 +23,5 @@ const pickVersion = (event)=>{
|
|
|
31
23
|
// '1.0' is a safer default
|
|
32
24
|
return event.version ?? (event.method ? 'vpc' : '1.0');
|
|
33
25
|
};
|
|
34
|
-
const isVersionHttpEvent = {
|
|
35
|
-
'1.0': (event)=>typeof event.httpMethod !== 'undefined',
|
|
36
|
-
'2.0': (event)=>typeof event.requestContext.http.method !== 'undefined',
|
|
37
|
-
vpc: (event)=>typeof event.method !== 'undefined'
|
|
38
|
-
};
|
|
39
26
|
export default httpEventNormalizerMiddleware;
|
|
40
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/http-event-normalizer",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Http event normalizer middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"type": "github",
|
|
60
60
|
"url": "https://github.com/sponsors/willfarrell"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "b2d327653ca8c7786b6481d538be76fde714c0da",
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@middy/core": "5.0.
|
|
64
|
+
"@middy/core": "5.0.1",
|
|
65
65
|
"@types/aws-lambda": "^8.10.101"
|
|
66
66
|
}
|
|
67
67
|
}
|