lambder 1.0.76 → 1.0.78
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/dist/Lambder.d.ts +1 -0
- package/dist/Lambder.js +2 -1
- package/package.json +1 -1
- package/src/Lambder.ts +3 -1
package/dist/Lambder.d.ts
CHANGED
package/dist/Lambder.js
CHANGED
|
@@ -25,10 +25,11 @@ export const createContext = (event, lambdaContext, apiPath) => {
|
|
|
25
25
|
catch (e) { }
|
|
26
26
|
const isAPICall = method === "POST" && apiPath && path === apiPath && post.apiName;
|
|
27
27
|
const apiName = isAPICall ? post.apiName : null;
|
|
28
|
+
const apiPayload = isAPICall ? post.payload : null;
|
|
28
29
|
if (/^(((\d+\.)+\d+)|(([a-f\d]+:)+[a-f\d]+))$/.test(host)) {
|
|
29
30
|
throw new Error("[404] Host cannot be an ip address: " + host);
|
|
30
31
|
}
|
|
31
|
-
return { host, path, pathParams, method, get, post, cookie, apiName, headers, session, lambdaContext };
|
|
32
|
+
return { host, path, pathParams, method, get, post, cookie, apiName, apiPayload, headers, session, lambdaContext };
|
|
32
33
|
};
|
|
33
34
|
export default class Lambder {
|
|
34
35
|
apiPath;
|
package/package.json
CHANGED
package/src/Lambder.ts
CHANGED
|
@@ -27,6 +27,7 @@ type LambderRenderContext = {
|
|
|
27
27
|
post: Record<string, any>;
|
|
28
28
|
cookie: Record<string, any>;
|
|
29
29
|
apiName: string;
|
|
30
|
+
apiPayload: any;
|
|
30
31
|
headers: APIGatewayProxyEventHeaders;
|
|
31
32
|
session: LambderSession|null;
|
|
32
33
|
lambdaContext: Context;
|
|
@@ -68,9 +69,10 @@ export const createContext = (
|
|
|
68
69
|
}catch(e){}
|
|
69
70
|
const isAPICall = method === "POST" && apiPath && path === apiPath && post.apiName;
|
|
70
71
|
const apiName:string = isAPICall ? post.apiName : null;
|
|
72
|
+
const apiPayload:string = isAPICall ? post.payload : null;
|
|
71
73
|
|
|
72
74
|
if(/^(((\d+\.)+\d+)|(([a-f\d]+:)+[a-f\d]+))$/.test(host)){ throw new Error("[404] Host cannot be an ip address: " + host); }
|
|
73
|
-
return { host, path, pathParams, method, get, post, cookie, apiName, headers, session, lambdaContext };
|
|
75
|
+
return { host, path, pathParams, method, get, post, cookie, apiName, apiPayload, headers, session, lambdaContext };
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
|