Skip to content

Default Content-Type header to application/json if omitted #4568

@michaelsproul

Description

@michaelsproul

Description

It would make our HTTP API slightly more ergonomic to use via curl if it didn't error when the Content-Type header is omitted.

This seems to be acceptable according to the HTTP spec:

https://stackoverflow.com/questions/15860742/is-content-type-mandatory-in-http-post-request

I think using application/json as the default for most endpoints is OK, as that's usually what one is munging around on the CLI. If the user is sending binary they should be savvy enough to set the header (we could maybe log a warning if the error message doesn't already make it clear enough that Lighthouse attempted to parse JSON data).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions