Skip to content

Commit

Permalink
Integrate Changes
Browse files Browse the repository at this point in the history
Integrate Changes
  • Loading branch information
gabrielforster authored Oct 3, 2023
2 parents e925df8 + 080f6fb commit 0f68627
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions __tests__/lambda/formatters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ describe('invoke', () => {
it('Should returns response formatted with headers', () => {
expect(formattedResponse({
StatusCode: 200,
Payload: '{"headers":"{\\"total-count\\":\\"20\\"}"}'
Payload: '{"headers": {"total-count":"20"}}'
})).toEqual({ headers: { 'total-count': '20' }, status: 200, body: {} })
})

it('Should returns response formatted with headers and body', () => {
expect(formattedResponse({
StatusCode: 200,
Payload: '{"headers": "{\\"total-count\\":\\"20\\"}","body": "{\\"name\\":\\"John Doe\\"}"}'
Payload: '{"headers": {"total-count":"20"},"body": "{\\"name\\":\\"John Doe\\"}"}'
})).toEqual({ headers: { 'total-count': '20' }, status: 200, body: { name: 'John Doe' } })
})

Expand Down
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": "0.16.3",
"version": "0.16.4",
"description": "Utils library for Javascript",
"keywords": [],
"author": {
Expand Down
2 changes: 1 addition & 1 deletion src/lambda/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const formattedResponse = ({ StatusCode, Payload }: { StatusCode?: number
return {
status: payloadFormatted.statusCode || StatusCode,
body: payloadFormatted.body ? JSON.parse(payloadFormatted.body) : {},
...(payloadFormatted.headers ? { headers: JSON.parse(payloadFormatted.headers) } : null)
...(payloadFormatted.headers ? { headers: payloadFormatted.headers } : null)
}
}

Expand Down

0 comments on commit 0f68627

Please sign in to comment.