Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: Provide an option to increase request payload size in server implementation #959

Open
@siwachabhi

Description

@siwachabhi

Description

Is your feature request related to a problem? Please describe.
When building a server which can accept larger than 4MB payload size, current implementation has a fixed limit to reject it.

Describe the solution you'd like
Make this a configurable parameter, so servers can configure

Describe alternatives you've considered
Workaround is to use something like this: https://stackoverflow.com/questions/12496089/how-can-i-override-a-constant-in-an-imported-python-module, which can backward incompatible.

Other options is to provide a separate path for larger file I/O, but that seems redundant.

Additional context

body = await request.body()
if len(body) > MAXIMUM_MESSAGE_SIZE:
response = self._create_error_response(
"Payload Too Large: Message exceeds maximum size",
HTTPStatus.REQUEST_ENTITY_TOO_LARGE,
)
await response(scope, receive, send)
return

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions