Skip to content

request-metadata client scenario crashes on empty-body GET #408

Description

@tsarlandie-oai

Bug

The request-metadata client scenario assumes every request has a JSON body.
Its HTTP handler unconditionally calls JSON.parse(body), so a client that
sends a GET request to the endpoint causes the conformance runner to crash:

SyntaxError: Unexpected end of JSON input
    at JSON.parse
    at IncomingMessage.<anonymous>

Streamable HTTP clients may send GET requests to open an SSE stream or probe
the endpoint. A conformance fixture should respond to those requests without
terminating the entire runner.

Reproduction

node dist/index.js client \
  --command '<client that sends GET before/alongside POST>' \
  --scenario request-metadata \
  --spec-version 2026-07-28

The runner exits before writing checks.json.

Proposed fix

Because this scenario only evaluates metadata on POST requests:

  • Reject unsupported non-POST methods with 405 before reading a request body.
  • Only parse JSON for POST requests.
  • Return a JSON-RPC parse error for malformed POST bodies instead of crashing.

Add regression tests showing that empty-body GET and DELETE requests do not
crash the scenario and that malformed POST input receives a structured error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions