Skip to content

Commit

Permalink
fix: adjust lambda payload decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
CauaKath committed Mar 25, 2024
1 parent 2e6307e commit 737e456
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adapcon-utils-js",
"version": "1.2.1",
"version": "1.2.2",
"description": "Utils library for Javascript",
"keywords": [],
"author": {
Expand Down
4 changes: 1 addition & 3 deletions src/lambda/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import jsonBigInt from 'json-bigint'

import { isObject } from '../object'

const ascii = new TextDecoder('ascii')

export const formattedResponse = <T>({ StatusCode, Payload }: { StatusCode?: number, Payload?: any }): { status: number, body: T } => {
const payloadFormatted = Payload ? JSON.parse(ascii.decode(Payload)) : {}
const payloadFormatted = Payload ? JSON.parse(Buffer.from(Payload, 'ascii').toString('utf8')) : {}

return {
status: payloadFormatted.statusCode || StatusCode,
Expand Down

0 comments on commit 737e456

Please sign in to comment.