From fe3d9ea14ff437961871d11a0fc3da8acaf88105 Mon Sep 17 00:00:00 2001
From: Jan Tattermusch <jtattermusch@google.com>
Date: Mon, 19 Oct 2015 18:10:45 -0700
Subject: [PATCH] fix ruby per_rpc_creds

---
 src/ruby/pb/test/client.rb | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/ruby/pb/test/client.rb b/src/ruby/pb/test/client.rb
index e6d52232727..1388685734a 100755
--- a/src/ruby/pb/test/client.rb
+++ b/src/ruby/pb/test/client.rb
@@ -255,6 +255,12 @@ class NamedTests
   def per_rpc_creds
     auth_creds = Google::Auth.get_application_default(@args.oauth_scope)
     kw = auth_creds.updater_proc.call({})
+
+    # TODO(jtattermusch): downcase the metadata keys here to make sure
+    # they are not rejected by C core. This is a hotfix that should
+    # be addressed by introducing auto-downcasing logic.
+    kw = Hash[ kw.each_pair.map { |k, v|  [k.downcase, v] }]
+
     resp = perform_large_unary(fill_username: true,
                                fill_oauth_scope: true,
                                **kw)