Skip to content

Docs: Event Handler - Rest API - Example response.json in fined grained responses not formatted correctly #1223

Closed
@michaelbrewer

Description

@michaelbrewer

Expected Behaviour

response.json should be correctly formatted at https://awslabs.github.io/aws-lambda-powertools-python/latest/core/event_handler/api_gateway/#fine-grained-responses

Current Behaviour

Selecting response.json looks like this

Screen Shot 2022-05-20 at 1 10 32 PM

Code snippet

{ "body": "{\"message\":\"I\'m a teapot\"}", "headers": { "Content-Type": "application/json", "X-Custom": "X-Value" }, "isBase64Encoded": false, "statusCode": 418 }

Possible Solution

=== "response.json"

    ```json
    {
        "statusCode": 200,
        "headers": {
            "Content-Type": "application/json"
        },
        "body": "{\"message\":\"hello universe\"}",
        "isBase64Encoded": false
    }
    ```

Correctly format like PR #1117 and example deployed here https://gyft.github.io/aws-lambda-powertools-python/latest/core/event_handler/api_gateway/#fine-grained-responses

See screenshot of fix
Screen Shot 2022-05-20 at 1 16 52 PM

Steps to Reproduce

  1. Go to https://awslabs.github.io/aws-lambda-powertools-python/latest/core/event_handler/api_gateway/#fine-grained-responses
  2. Select response.json

AWS Lambda Powertools for Python version

latest

AWS Lambda function runtime

3.9

Packaging format used

PyPi

Debugging logs

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions