Skip to main content

json_body_or_else

Function json_body_or_else 

Source
pub fn json_body_or_else<T>(
    body: Result<Json<T>, JsonRejection>,
    allow_missing: bool,
    default: impl FnOnce() -> T,
) -> JsonBodyOutcome<T>
Expand description

Parse body, or call default when the client omitted the JSON content type and allow_missing is set. Any other rejection short-circuits with a rendered error response.