Skip to content

Commit

Permalink
Merge pull request #12 from savvyintegrations/add-to-result-unencoded
Browse files Browse the repository at this point in the history
feat: add toResultUnencoded
  • Loading branch information
jfrconley authored Dec 1, 2023
2 parents 6140062 + 35c0972 commit a962039
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/fair-dolphins-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nornir/rest": minor
---

Add toResultUnencoded method.
9 changes: 9 additions & 0 deletions packages/rest/src/runtime/converters.mts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ export abstract class ApiGatewayProxyV2 {
statusCode: +event.statusCode
}
}

public static toResultUnencoded(event: SerializedHttpResponse): APIGatewayProxyStructuredResultV2 {
return {
headers: event.headers,
body: event.body.toString("utf8"),
isBase64Encoded: false,
statusCode: +event.statusCode
}
}
}

export async function startLocalServer(chain: Nornir<UnparsedHttpEvent, SerializedHttpResponse>, port = 8080) {
Expand Down

0 comments on commit a962039

Please sign in to comment.