Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

load_json_body is triggered only when event["body"] is a string. Is there a good reason for it? #30

@martinezpl

Description

@martinezpl

Because I only see reasons against it:

  1. Simply because a JSON can be passed also as bytes - hence json.loads() method accepts types of bytes and bytearray as well.
  2. If I decide to use this decorator on a handler it means I expect a JSON in the body, therefore I'd like it to return a 400 even when the input is not a string. This could be skipped it the body is already a dictionary.

I understand changing the logic to start acting on non-strings is most likely breaking. If a maintainer gives a green light, I can create a PR.

Also, I am curious of other opinions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions