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

Should there be support for base64 encoded binary header values in Metadata? #2566

Open
richardjanssen opened this issue Oct 25, 2024 · 0 comments
Labels
question Further information is requested

Comments

@richardjanssen
Copy link

In Grpc.Core.Metadata.Entry there are two constructors for creating metadata entries. One for string values and one for binary values. These constructors validate that the entry key either has or does not have a -bin suffix, depending on the used constructor. In practice these constructors are sometimes used to parse HTTP headers into metadata, e.g. here. I encountered a situation interacting with a Google Speech-to-Text API where headers with a -bin suffix are included in a HTTP response, but their values are Base64 encoded strings (of byte arrays). This causes exceptions to be thrown when creating Metadata from these responses, as string valued headers cannot have a -bin suffix.

I believe encoding binary headers to Base64 is a common practice and therefore wonder if such cases should be parsed correctly when creating Metadata entries? Or is it the responsibility of whoever decides to create the Metadata object that all headers have valid combinations of key value types?

@richardjanssen richardjanssen added the question Further information is requested label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant