lambder 1.0.73 → 1.0.74

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.js CHANGED
@@ -13,7 +13,8 @@ export const createContext = (event, lambdaContext, apiPath) => {
13
13
  const headers = event.headers;
14
14
  let post = {};
15
15
  const session = null;
16
- const apiName = (method === "POST" && apiPath && path === apiPath && post.apiName) ? post.apiName : null;
16
+ const isAPICall = method === "POST" && apiPath && path === apiPath && post.apiName;
17
+ const apiName = isAPICall ? post.apiName : null;
17
18
  try {
18
19
  const decodedBody = event.isBase64Encoded ? (event.body ? Buffer.from(event.body, "base64").toString() : "{}") : (event.body || "{}");
19
20
  try {
@@ -15,7 +15,7 @@ export default class LambderCaller {
15
15
  fetchEndedHandler;
16
16
  constructor({ isCorsEnabled = false, apiPath, apiVersion, versionExpiredHandler, sessionExpiredHandler, messageHandler, errorMessageHandler, notAuthorizedHandler, errorHandler, fetchStartedHandler, fetchEndedHandler, }) {
17
17
  this.isCorsEnabled = isCorsEnabled;
18
- this.apiPath = apiPath;
18
+ this.apiPath = apiPath ?? "/api";
19
19
  this.apiVersion = apiVersion;
20
20
  this.versionExpiredHandler = versionExpiredHandler;
21
21
  this.sessionExpiredHandler = sessionExpiredHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambder",
3
- "version": "1.0.73",
3
+ "version": "1.0.74",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/Lambder.ts CHANGED
@@ -61,7 +61,8 @@ export const createContext = (
61
61
  const headers = event.headers;
62
62
  let post: Record<string, any> = {};
63
63
  const session = null;
64
- const apiName:string = (method === "POST" && apiPath && path === apiPath && post.apiName) ? post.apiName : null;
64
+ const isAPICall = method === "POST" && apiPath && path === apiPath && post.apiName;
65
+ const apiName:string = isAPICall ? post.apiName : null;
65
66
  try {
66
67
  const decodedBody = event.isBase64Encoded ? ( event.body ? Buffer.from(event.body,"base64").toString() : "{}" ) : ( event.body || "{}" );
67
68
  try { post = JSON.parse(decodedBody) || {}; }
@@ -65,7 +65,7 @@ export default class LambderCaller {
65
65
  }
66
66
  ){
67
67
  this.isCorsEnabled = isCorsEnabled;
68
- this.apiPath = apiPath;
68
+ this.apiPath = apiPath ?? "/api";
69
69
  this.apiVersion = apiVersion;
70
70
 
71
71
  this.versionExpiredHandler = versionExpiredHandler;