Package-level declarations
| Entry point | Role |
|---|---|
| problemXml | Inside HttpResponseValidator { }: convert an application/problem+xml response into ProblemException. |
Two behaviors here are decisions, not defaults, and each is pinned by a test:
There is no lenient mode.
problemXml()takes no parameters, and plainapplication/xmlnever matches. The JSON side offersacceptPlainJsonbecause tooling overwhelmingly labels everythingapplication/json; XML has no equivalent convention, and an application's own XML dialect is not this library's media type to claim. With only one way in, there is also only one failure rule: a body labeledapplication/problem+xmlthat fails to decode propagates asSerializationExceptionrather than falling back to Ktor's own exception. That covers both of the reader's refusals — a malformed document, and a well-formed one rooted at something other than<problem xmlns="urn:ietf:rfc:7807">.The transport's charset wins. The body is read with the charset the response declares, falling back to UTF-8; a document's own
encodingpseudo-attribute is never consulted, since the bytes are already text by the time the codec sees them. RFC 7303 makes the transport authoritative for+xmlmedia types, so this is the order the specification asks for — and it matches how the JSON half reads its bodies.
Functions
Turns a recognized application/problem+xml response into the same ProblemException that application code throws on the server side and problem-details-ktor answers. This is the XML twin of problemJson.