feat(bigtable): preserve base64 padding on bigtable-features header#16108
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new utility function, UrlsafeBase64EncodeWithPadding, in the base64_transforms header and updates the Bigtable stub factory to use this version for features metadata, accompanied by a new unit test. The review suggests refactoring the duplicated logic between the two encoding functions to improve maintainability and recommends caching the features metadata result using a static variable to avoid redundant computations.
Go's conformant `base64.URLEncoding.DecodeString` requires base64 padding (`=`) to decode successfully, failing with status 16 when padding is missing. To resolve this, introduce `UrlsafeBase64EncodeWithPadding` helper that preserves base64 padding and use it to encode features metadata in the bigtable stub factory.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16108 +/- ##
=======================================
Coverage 92.71% 92.71%
=======================================
Files 2353 2353
Lines 218692 218700 +8
=======================================
+ Hits 202764 202777 +13
+ Misses 15928 15923 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Go's conformant
base64.URLEncoding.DecodeStringrequires base64 padding (=) to decode successfully, failing with status 16 when padding is missing.To resolve this, introduce
UrlsafeBase64EncodeWithPaddinghelper that preserves base64 padding and use it to encode features metadata in the bigtable stub factory.