Skip to content

Potentially request.body can be None when using a custom adapter #330

Description

@matteobaldelli

I think you should swap the order of this line, with aws_lambda body is None so the code will raise the exception inside the if condition. L49 not make any sense in this order because if body is None the code will always raise exception inside the if condition

if not isinstance(body, str):
raise BoltError(error_message_raw_body_required_in_http_mode())
self.raw_body = body if body is not None else ""

Activity

  1. added this to the 1.6.1 milestone on May 8, 2021
  2. seratch commented on May 8, 2021

    @seratch
    Contributor

    Hi @matteobaldelli, thanks for taking the time to report this issue!

    As long as you use the adapter in this project, the body cannot be None. However, if a developer implements their own adapter, the body is possibly None in some cases.

    I will update the code (perhaps, rather than swapping the lines, I will update the L47 to check if it's not None).

  3. changed the title [-]BoltError: `body` must be a raw string data when running in the HTTP server mode[/-] [+]Potentially request.body can be None when using a custom adapter[/+] on May 8, 2021
  4. added a commit that references this issue on May 10, 2021
    ace3cb8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions