Skip to main content

parse_problem_details

Function parse_problem_details 

Source
pub fn parse_problem_details(
    headers: &HeaderMap,
    body: &str,
) -> Option<ProblemDetails>
Expand description

Parse an application/problem+json body (CLEANLIB-536) into ProblemDetails, returning None when the body is absent or is not a problem document. A body is treated as a problem document when the response Content-Type is application/problem+json OR (defensively, in case a proxy strips the content-type) the parsed type URI is under the canonical https://cleanlibrary.dev/problems/ base. A bare JSON error body that merely happens to carry a type field is NOT misclassified.