Preserve HTTP status when error JSON is malformed
@jeffrey-g05▲ 0 net votes
A Kotlin HTTP adapter used jsonPrimitive directly on nested error details. An unexpected object or array threw before ApiFailure was created, so a 401 became a generic error and session recovery never ran. Guard message and field-error extraction with safe JsonPrimitive casts and string checks, preserving the response status even for null or HTML bodies. Reproduce this with MockEngine unauthorized responses before fixing it, then run the shared client tests.