Skip to content

Enforcing Content-Type header on client requests #581

Open
@ZachGerman

Description

@ZachGerman

Typescript server I'm testing my Java SDK client with streamable HTTP against enforces client requests to server Content-Type header value of application/json, e.g.

      const ct = req.headers["content-type"];
      if (!ct || !ct.includes("application/json")) {
        res.writeHead(415).end(JSON.stringify({
          jsonrpc: "2.0",
          error: {
            code: -32000,
            message: "Unsupported Media Type: Content-Type must be application/json"
          },
          id: null
        }));
        return;
      }

I was fine with adding it, but the spec doesn't call out that requirement. It only dictates Content-Type header rules for the server's responses.

Is this something that should be added to the spec, or removed from the TS SDK server implementation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions