Skip to main content

accepts_json

Function accepts_json 

Source
pub fn accepts_json(headers: &HeaderMap, lenient: bool) -> bool
Available on crate feature server only.
Expand description

The default reading of the Content-Type rule.

The HTTP header: Content-Type SHALL be set to application/json for any request that contains a message body.

application/json; charset=utf-8 is accepted, because it says the same thing and is extremely common. lenient additionally accepts an absent or unrelated type, for a peer that cannot be persuaded to set it.