Skip to content

[body-data] handle body in requests without content-type header #1005

@maxakuru

Description

@maxakuru

Right now it looks like if a request is missing content-type but contains a body, the body is never consumed and instead only the search params are treated as data

in this case maybe we can either:

  1. implicitly read the body as text, and attempt JSON parsing, but ignore any error that may occur (and treat as empty body, continue to read the search params as the data)
  2. reject the request with a 400

In the last 7 days it looks like we received ~25k POSTs with a body and no content-type to admin (excluding /hook/github and /hook/slack) so option 2 might be too aggressive.

I'm unsure of how/if those bodies are being handled at the moment, though. Maybe they're quietly being treated as empty bodies and the client is unaware the request is being handled differently than they expect? wdyt @tripodsan?

see also https://github.com/adobe/helix-admin/issues/2570

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