Skip to content

Compare Content-Type media types case-insensitively - #12

Open
durang wants to merge 2 commits into
prooflinedev:mainfrom
durang:fix/content-type-case-insensitive
Open

durang wants to merge 2 commits into
prooflinedev:mainfrom
durang:fix/content-type-case-insensitive

Conversation

@durang

@durang durang commented Nov 20, 2026

Copy link
Copy Markdown

The stdio bridge refused a successful JSON response when the upstream Content-Type media type was not an exact lowercase application/json. HTTP media types are case-insensitive (RFC 9110), and servers commonly send Application/JSON or application/json; charset=utf-8. That made a valid tool result look like a transport failure.

The check now compares only the media type, case-insensitively, and still ignores parameters after ;. SSE (text/event-stream) is still refused, including when the type differs only by case. No protocol, retry, or session behavior changes.

const mediaType = (value) => value?.split(";")[0].trim().toLowerCase();
// ...
mediaType(response.headers.get("content-type")) !== "application/json"

Who this helps

Agents using @proofline/mcp against a proxy, gateway or hosted endpoint that capitalizes Content-Type or adds a charset. Today those sessions exit 1 with Proofline MCP transport failure even though the JSON body is valid.

Verification

  • tests/bridge.test.js covers mixed-case JSON (Application/JSON and APPLICATION/JSON; charset=utf-8) and still refuses TEXT/EVENT-STREAM without leaking the body.
  • npm run check, npm test (14 tests, 0 failures) and npm run test:package pass locally on Node 22+.

This branch has not been deployed

No deployments
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.

1 participant