Skip to content

Basic client example isn't working - any ideas on how to proceed with 415 error code? #622

Answered by timostamm
jeffnsquared asked this question in Q&A
Discussion options

You must be logged in to vote

The spec allows both application/grpc and application/grpc+proto for the binary protobuf format, so it might be a good call to allow both on the server.

You can use an interceptor to modify the request headers:

const modifyProtocolHeaders: Interceptor = (next) => async (req) => {
  if (req.header.get("Content-Type") === "application/grpc+proto") {
    req.header.set("Content-Type", "application/grpc");
  }
  return await next(req);
}

Usage:

createConnectTransport({
  baseUrl: "https://example.com",
  httpVersion: "2",
  interceptors: [ modifyProtocolHeaders ]
});

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@jeffnsquared
Comment options

@timostamm
Comment options

@jeffnsquared
Comment options

@timostamm
Comment options

Answer selected by jeffnsquared
@jeffnsquared
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants