Skip to content

feat(data-classes): decode base64 encoded body#425

Merged
heitorlessa merged 6 commits into
aws-powertools:developfrom
gyft:feat-decode-body
May 17, 2021
Merged

feat(data-classes): decode base64 encoded body#425
heitorlessa merged 6 commits into
aws-powertools:developfrom
gyft:feat-decode-body

Conversation

@michaelbrewer

@michaelbrewer michaelbrewer commented May 7, 2021

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

Code example:

def lambda_handler(event: dict, context):
    event = APIGatewayProxyEvent(event)
    # Dynamically base64 decode body as a str
    body: str = event.decoded_body
    print(body)

Where the event is:

{
  "body": "W3siaWQiOjEsIm5hbWUiOiJDb21wYW55IE9uZSJ9LHsiaWQiOjIsIm5hbWUiOiJDb21wYW55IFR3byJ9XQo=",
   "isBase64Encoded": true
}

Print statement:

[{"id":1,"name":"Company One"},{"id":2,"name":"Company Two"}]

Checklist

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov-commenter

codecov-commenter commented May 7, 2021

Copy link
Copy Markdown

Codecov Report

Merging #425 (7183448) into develop (22754d3) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #425   +/-   ##
========================================
  Coverage    99.90%   99.90%           
========================================
  Files          102      102           
  Lines         4117     4124    +7     
  Branches       204      205    +1     
========================================
+ Hits          4113     4120    +7     
  Misses           1        1           
  Partials         3        3           
Impacted Files Coverage Δ
...lambda_powertools/utilities/data_classes/common.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 22754d3...7183448. Read the comment docs.

@heitorlessa heitorlessa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change and it's good to merge and release 🎉

Comment thread aws_lambda_powertools/utilities/data_classes/common.py Outdated
@heitorlessa heitorlessa added this to the 1.16.0 milestone May 17, 2021
Michael Brewer and others added 2 commits May 17, 2021 06:09
Co-authored-by: Heitor Lessa <heitor.lessa@hotmail.com>
@heitorlessa heitorlessa merged commit 77c1e40 into aws-powertools:develop May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants