Package-level declarations
| Entry point | Role |
|---|---|
| problemJson | Inside HttpResponseValidator { }: convert a recognized problem response into ProblemException. |
Two behaviors here are decisions, not defaults, and each is pinned by a test:
application/problem+jsonand a plainapplication/jsonare not trusted equally. A response strictly labeledapplication/problem+jsonthat fails to decode is a broken promise from the server and propagates loudly, asSerializationException. A response merely labeledapplication/json(matched only whenacceptPlainJson = true) was never a promise about shape — a decode failure there falls back silently to Ktor's ownClientRequestException/ServerResponseException.acceptPlainJsondefaults tofalse, the opposite ofproblem-details-ktor's ownacceptPlainJson = truedefault, because it now governs bodies from servers this project does not control, not this project's own well-formed output. Note that on this side the flag reads the response'sContent-Type; it has nothing to do with theAcceptheader, which this module never sets.A redirect answered with a problem document is replaced too. Every status Ktor raises a
ResponseExceptionfor qualifies — 3xx included, not just 4xx/5xx. A server that explains a redirect it cannot perform gets the same treatment as one that explains a failure.
Functions
Turns a recognized application/problem+json response into the same ProblemException that application code throws on the server side and problem-details-ktor answers.