@certik/serverless-api 1.0.9 → 1.0.10

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.0.10
2
+
3
+ - fixed unicode handling
4
+
1
5
  # 1.0.9
2
6
 
3
7
  - fixed CORS
package/entrypoint.js CHANGED
@@ -34,7 +34,7 @@ export const handler = async (event, context) => {
34
34
  let body = event.body ? event.body : null;
35
35
 
36
36
  if (event.isBase64Encoded && body) {
37
- body = atob(body);
37
+ body = Buffer.from(body, "base64").toString("utf-8");
38
38
  }
39
39
 
40
40
  const rp = await currentRoute.handler(
package/lib/dev.js CHANGED
@@ -14,7 +14,9 @@ export function mapRequestToEvent(req) {
14
14
  headers: req.headers,
15
15
  multiValueHeaders: {},
16
16
  queryStringParameters: req.query,
17
- body: btoa(req.body.toString()),
17
+ body: Buffer.isBuffer(req.body)
18
+ ? req.body.toString("base64")
19
+ : Buffer.from(req.body, "utf-8").toString("base64"),
18
20
  isBase64Encoded: true,
19
21
  };
20
22
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "CertiK Engineering",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
- "version": "1.0.9",
7
+ "version": "1.0.10",
8
8
  "scripts": {
9
9
  "start": "doppler run -- nodemon start-dev.js",
10
10
  "lint": "eslint lib test routes *.js",