diff options
-rw-r--r-- | kamon-spray/src/main/scala/kamon/spray/instrumentation/ServerRequestInstrumentation.scala | 2 | ||||
-rw-r--r-- | kamon-spray/src/test/scala/kamon/spray/SprayServerTracingSpec.scala | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/kamon-spray/src/main/scala/kamon/spray/instrumentation/ServerRequestInstrumentation.scala b/kamon-spray/src/main/scala/kamon/spray/instrumentation/ServerRequestInstrumentation.scala index 82d3ceb1..b1bca22d 100644 --- a/kamon-spray/src/main/scala/kamon/spray/instrumentation/ServerRequestInstrumentation.scala +++ b/kamon-spray/src/main/scala/kamon/spray/instrumentation/ServerRequestInstrumentation.scala @@ -38,7 +38,7 @@ class ServerRequestInstrumentation { val defaultTraceName = SprayExtension.generateTraceName(request) val token = if (SprayExtension.settings.includeTraceTokenHeader) { - request.headers.find(_.name == SprayExtension.settings.traceTokenHeaderName).map(_.value) + request.headers.find(_.name.equalsIgnoreCase(SprayExtension.settings.traceTokenHeaderName)).map(_.value) } else None val newContext = tracer.newContext(defaultTraceName, token) diff --git a/kamon-spray/src/test/scala/kamon/spray/SprayServerTracingSpec.scala b/kamon-spray/src/test/scala/kamon/spray/SprayServerTracingSpec.scala index 45a704db..7adb6e1c 100644 --- a/kamon-spray/src/test/scala/kamon/spray/SprayServerTracingSpec.scala +++ b/kamon-spray/src/test/scala/kamon/spray/SprayServerTracingSpec.scala @@ -69,6 +69,20 @@ class SprayServerTracingSpec extends BaseKamonSpec("spray-server-tracing-spec") response.headers should not contain traceTokenHeader("propagation-disabled") } + + "check for the trace-token header in a case-insensitive manner" in { + enableAutomaticTraceTokenPropagation() + + val (connection, server) = buildClientConnectionAndServer + val client = TestProbe() + + client.send(connection, Get("/").withHeaders(RawHeader(SprayExtension.settings.traceTokenHeaderName.toLowerCase, "case-insensitive"))) + server.expectMsgType[HttpRequest] + server.reply(HttpResponse(entity = "ok")) + val response = client.expectMsgType[HttpResponse] + + response.headers should contain(traceTokenHeader("case-insensitive")) + } } def traceTokenHeader(token: String): RawHeader = |