fix(http): answer in MessagePack to MessagePack bodies without Accept header (#93) #94

Merged
crapougnax merged 1 commit from fix/93-http-msgpack-response-follows-msgpack-body into develop 2026-12-03 10:17:48 +00:00
Owner

Summary

msgPackContentNegotiation answered in JSON to clients that post a MessagePack body without an Accept header, so a MessagePack-only client (TotalYmage Unity app) failed with "Unexpected msgpack code 123" (123 is the opening brace of a JSON object).

Key Changes

  • New exported shouldRespondMsgPack(req, isMsgPackBody): the response is MessagePack when the client asks for it (Accept header or format=msgpack query), or when the request body is MessagePack and Accept does not explicitly ask for JSON (application/json or +json).
  • Unchanged: JSON bodies and requests without body still get JSON when Accept is absent.

Verification

  • jest packages/http: 31 pass, 9 new (negotiation matrix, MessagePack body without Accept, explicit JSON Accept).
  • tsc --noEmit on packages/http: clean.
  • Branch based on an older develop; the commits since then do not touch packages/http and merge without conflict.

Follow-up

  • Publish @quatrain/http and bump it in TotalYmage backend so staging benefits from it.

Closes #93

🤖 Generated with Claude Code

## Summary msgPackContentNegotiation answered in JSON to clients that post a MessagePack body without an Accept header, so a MessagePack-only client (TotalYmage Unity app) failed with "Unexpected msgpack code 123" (123 is the opening brace of a JSON object). ### Key Changes - New exported shouldRespondMsgPack(req, isMsgPackBody): the response is MessagePack when the client asks for it (Accept header or format=msgpack query), or when the request body is MessagePack and Accept does not explicitly ask for JSON (application/json or +json). - Unchanged: JSON bodies and requests without body still get JSON when Accept is absent. ### Verification - jest packages/http: 31 pass, 9 new (negotiation matrix, MessagePack body without Accept, explicit JSON Accept). - tsc --noEmit on packages/http: clean. - Branch based on an older develop; the commits since then do not touch packages/http and merge without conflict. ### Follow-up - Publish @quatrain/http and bump it in TotalYmage backend so staging benefits from it. Closes #93 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(http): answer in MessagePack to MessagePack bodies without Accept header (#93)
All checks were successful
Quatrain Core CI / Monorepo Build, Tests & Quality Audit (pull_request) Successful in 3m0s
Quatrain Core CI / Publish Changed Packages to npm (pull_request) Has been skipped
18bb84afb7
A client posting a MessagePack body (e.g. Unity) but omitting the
`Accept: application/x-msgpack` header received a JSON response it
could not decode ("Unexpected msgpack code 123").

The response is now MessagePack when the client asks for it (Accept or
?format=msgpack), or when the request body is MessagePack and Accept
does not explicitly ask for JSON (`application/json` or `+json`).

Closes #93

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crapougnax merged commit 64a113b847 into develop 2026-12-03 10:17:48 +00:00
crapougnax deleted branch fix/93-http-msgpack-response-follows-msgpack-body 2026-12-03 10:17:48 +00:00
Sign in to join this conversation.
No description provided.