Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from May 17, 2021

Conversation

michaelbrewer
Copy link
Contributor

@michaelbrewer michaelbrewer commented May 7, 2021

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
Copy link

codecov-commenter commented May 7, 2021

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.

Copy link
Contributor

@heitorlessa heitorlessa left a comment

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 🎉

aws_lambda_powertools/utilities/data_classes/common.py Outdated Show resolved Hide resolved
@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
@michaelbrewer michaelbrewer deleted the feat-decode-body branch August 3, 2021 23:51
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.

None yet

3 participants