You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ma...@apache.org on 2018/07/23 21:18:06 UTC

[incubator-openwhisk] branch master updated: Make request id header name comparison case insensitive. (#3889)

This is an automated email from the ASF dual-hosted git repository.

markusthoemmes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 5694f38  Make request id header name comparison case insensitive. (#3889)
5694f38 is described below

commit 5694f38d000bd2c631a9fe754422dd960bc5d88c
Author: tysonnorris <ty...@gmail.com>
AuthorDate: Mon Jul 23 14:18:01 2018 -0700

    Make request id header name comparison case insensitive. (#3889)
---
 common/scala/src/main/scala/whisk/common/TransactionId.scala  | 4 +++-
 common/scala/src/main/scala/whisk/http/BasicHttpService.scala | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/scala/src/main/scala/whisk/common/TransactionId.scala b/common/scala/src/main/scala/whisk/common/TransactionId.scala
index 6441629..ae86321 100644
--- a/common/scala/src/main/scala/whisk/common/TransactionId.scala
+++ b/common/scala/src/main/scala/whisk/common/TransactionId.scala
@@ -245,4 +245,6 @@ object TransactionId {
   }
 }
 
-case class TransactionGeneratorConfig(header: String)
+case class TransactionGeneratorConfig(header: String) {
+  val lowerCaseHeader = header.toLowerCase //to cache the lowercase version of the header name
+}
diff --git a/common/scala/src/main/scala/whisk/http/BasicHttpService.scala b/common/scala/src/main/scala/whisk/http/BasicHttpService.scala
index 586d7dc..fa4c612 100644
--- a/common/scala/src/main/scala/whisk/http/BasicHttpService.scala
+++ b/common/scala/src/main/scala/whisk/http/BasicHttpService.scala
@@ -108,7 +108,7 @@ trait BasicHttpService extends Directives {
     extract { req =>
       val tid =
         req.request.headers
-          .find(_.name == TransactionId.generatorConfig.header)
+          .find(_.is(TransactionId.generatorConfig.lowerCaseHeader))
           .map(_.value)
           .filterNot(_.startsWith(TransactionId.systemPrefix))
           .getOrElse {