Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying charset in the content-type header #89

Open
shouichi opened this issue Jun 10, 2022 · 2 comments
Open

Allow specifying charset in the content-type header #89

shouichi opened this issue Jun 10, 2022 · 2 comments

Comments

@shouichi
Copy link

Some HTTP clients always append charset to the content-type header e.g., content-type: application/json; charset=utf8. Requests made by those clients are rejected because of the content-type mismatch.

Twirp only allows the content-type header exactly matches one of aplication/json, application/json; strict=true or application/probobuf. This seems too strict, can we relax this constraint?

Thank you.

@ismailakbudak
Copy link

We are trying to send the application/grpc header. We override some parts of the code but, why is so strict, and do you know about the difference? Server is external server, so we can not see the server side :(

@ismailakbudak
Copy link

We are trying to send the application/grpc header. We override some parts of the code but, why is so strict, and do you know about the difference? Server is external server, so we can not see the server side :(

We changed following part;

module Twirp

  module Encoding
    JSON = "application/json"
    # An opt-in content type useful when curling or manually testing a twirp
    # service.  This will fail if unknown fields are encountered. The return
    # content type will be application/json.
    JSON_STRICT = "application/json; strict=true"
    # PROTO = "application/protobuf"
    PROTO = "application/grpc"

But when we try to read response from the server it is empty

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

No branches or pull requests

2 participants