fix(http): answer in MessagePack to MessagePack bodies sent without Accept header #93
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
qa:preview
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
quatrain/core#93
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
msgPackContentNegotiation()(@quatrain/http) only encodes the response as MessagePack when the client sendsAccept: application/x-msgpack(or?format=msgpack). A client that posts a MessagePack body but omitsAcceptgets a JSON response, which a MessagePack-only client cannot decode:Seen in TotalYmage staging with the Unity client on
POST /environments/:uid/versions/:vid/audit(the Unity HTTP helper does not setAccepton every request).Expected behaviour
Acceptexplicitly asks for JSON (application/jsonor+json).Accept: application/x-msgpack/?format=msgpackstill wins; JSON bodies or body-less requests withoutAcceptstill get JSON.Scope
packages/http/src/MsgPack.ts: new exportedshouldRespondMsgPack(req, isMsgPackBody)used by the middleware.