Skip to content

fix(public): show the message of the Public API's 401 - #1073

Merged
Topherhindman merged 1 commit into
mainfrom
fix/lk-public-api-401-message
Oct 23, 2026
Merged

Topherhindman merged 1 commit into
mainfrom
fix/lk-public-api-401-message

Conversation

@Topherhindman

@Topherhindman Topherhindman commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

The Public API's auth middleware answers 401 with {"error":{"code","message"}}, and its panic recovery answers 500 the same way, unlike the top-level message of the errors its handlers return. responseError only read the top level, so an expired or revoked session printed the raw JSON before the sign-in hint. It now reads the nested message too, so a server panic also shows internal server error instead of the raw body.

A top-level message still wins when both are present. An "error" that isn't an object, or has no message, doesn't hide the top-level message or the raw body.

Testing:

  • TestResponseError gains cases for the nested body, both levels set, a nested error without a message, and a non-object "error".
  • rejected-session.txtar drops its known-bug skip and passes in full.

@Topherhindman
Topherhindman force-pushed the fix/lk-public-api-401-message branch from 938dc99 to 5ff3b7b Compare October 23, 2026 17:11
@Topherhindman
Topherhindman force-pushed the auth-tests/lk-auth-scripts branch 2 times, most recently from 7d625e4 to e07a424 Compare October 23, 2026 17:53
@Topherhindman
Topherhindman force-pushed the fix/lk-public-api-401-message branch from 5ff3b7b to 0a54d64 Compare October 23, 2026 17:53
Base automatically changed from auth-tests/lk-auth-scripts to main October 23, 2026 19:24
The Public API's auth middleware answers 401 with
{"error":{"code","message"}}, and its panic recovery answers 500 the
same way, unlike the top-level message of the errors its handlers
return. responseError only read the top level, so an expired or revoked
session printed the raw JSON before the sign-in hint. It now reads the
nested message too, so a server panic also shows "internal server
error" instead of the raw body.
@Topherhindman
Topherhindman force-pushed the fix/lk-public-api-401-message branch from 0a54d64 to ec7316b Compare October 23, 2026 19:39
@Topherhindman
Topherhindman merged commit aa1f2b5 into main Oct 23, 2026
25 checks passed
@Topherhindman
Topherhindman deleted the fix/lk-public-api-401-message branch October 23, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants