diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2018-02-02 03:35:02 +0100 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2018-02-02 03:35:02 +0100 |
commit | 91b01c6bdc905db9db7874fb0a66574463a0d484 (patch) | |
tree | fc6293dd443c44ccf1aeb153e86aa8af6e50707c /kamon-core-tests/src | |
parent | 16a23e2346ccaca9f0f766faa17c15148eb6521c (diff) | |
download | Kamon-91b01c6bdc905db9db7874fb0a66574463a0d484.tar.gz Kamon-91b01c6bdc905db9db7874fb0a66574463a0d484.tar.bz2 Kamon-91b01c6bdc905db9db7874fb0a66574463a0d484.zip |
allow arbitrary header names for automatic broadcast string keys
Diffstat (limited to 'kamon-core-tests/src')
-rw-r--r-- | kamon-core-tests/src/test/resources/reference.conf | 5 | ||||
-rw-r--r-- | kamon-core-tests/src/test/scala/kamon/context/ContextCodecSpec.scala | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/kamon-core-tests/src/test/resources/reference.conf b/kamon-core-tests/src/test/resources/reference.conf index e69de29b..0d7ae9e2 100644 --- a/kamon-core-tests/src/test/resources/reference.conf +++ b/kamon-core-tests/src/test/resources/reference.conf @@ -0,0 +1,5 @@ +kamon { + context.codecs.string-keys { + request-id = "X-Request-ID" + } +}
\ No newline at end of file diff --git a/kamon-core-tests/src/test/scala/kamon/context/ContextCodecSpec.scala b/kamon-core-tests/src/test/scala/kamon/context/ContextCodecSpec.scala index bc46c998..f7bd7e56 100644 --- a/kamon-core-tests/src/test/scala/kamon/context/ContextCodecSpec.scala +++ b/kamon-core-tests/src/test/scala/kamon/context/ContextCodecSpec.scala @@ -48,6 +48,14 @@ class ContextCodecSpec extends WordSpec with Matchers with ContextTesting with O decodedContext.get(StringKey) shouldBe empty decodedContext.get(StringBroadcastKey).value shouldBe "this-should-be-round-tripped" } + + "read string broadcast keys using the configured header name" in { + val textMap = TextMap.Default() + textMap.put("X-Request-ID", "123456") + val decodedContext = ContextCodec.HttpHeaders.decode(textMap) + + decodedContext.get(Key.broadcastString("request-id")).value shouldBe "123456" + } } "encoding/decoding to Binary" should { |