-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[]byte in query now uses base64.StdEncoding #565
Conversation
Changed default encoding of []bytes in URL Query params to use standard padded base64 encoding to be consistent with representation in json serialized objects.
Thanks for your pull request. t looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
Signed the CLA. |
CLAs look good, thanks! |
Looks fine to me! The burden will be on the client to correctly escape the query parameters to avoid |
Do either of you know if it is possible to use the same base64 en/decoder that is provided by golang/protobuf? How does the deserialization work when they are processing JSONified protos? Could you point me to the code where they do that? |
golang/protobuf uses the stdlib json encoding/decoding. The go structs generated from the proto file are annotated for JSON encoding. Encoding byte slices to base64 is part of the stdlib:
You can find the source for the encoding here and the decoding here I think there is a bit of custom Marshal/Unmarshal code for handling enums and their string representations, but nothing for byte slices. |
@loderunner, fantastic research! Thanks so much. comments like that make merging easy (and fun). @lucasvo, thanks so much for finding the time to contribute to the project! I really look forward to working with you in the future. |
@loderunner did the heavy lifting, he deserves the credit! Thanks for helping out with this. |
This fixes the issue with different base64 string encoding in query params and json representations in the request body discussed in #423
@loderunner Care to review?