Skip to main content

parse_json_body

Function parse_json_body 

Source
pub fn parse_json_body<T: DeserializeOwned>(
    req: &HttpRequest,
) -> Result<T, HttpResponse>
Expand description

Parse a JSON request body strictly (RA-ERR-4):

  • If Content-Type is present and not JSON (application/json or +json), returns 415.
  • If the body is empty or malformed JSON, returns 400 application/problem+json.