Skip to content

Empty request with json content type fails with a JSONDecodeError when using the history panel #1330

Closed
@MDziwny

Description

@MDziwny

If an API request is made with an empty body and the content type application/json, the history panel raises an error and the whole API request fails.

For instance:

GET /api/whatever
Content-Type: application/json

Body: 

Result in 500 Internal Server Error, JSONDecodeError, Expecting value: line 1 column 1 (char 0)

We could argue that an empty body is not a valid application/json body (https://greenbytes.de/tech/webdav/rfc7159.html#values), but in this case, I believe it's not the role of django debug toolbar to raise an error if django accepts this kind of requests.

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