Skip to content
This repository was archived by the owner on Dec 8, 2020. It is now read-only.

Commit a74052c

Browse files
Merge branch 'master' of github.com:timberio/timber-elixir
2 parents 62e4b6d + fa05be1 commit a74052c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/timber/context_plug.ex

+9-5
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,16 @@ defmodule Timber.ContextPlug do
9090
@spec call(Plug.Conn.t, Plug.opts) :: Plug.Conn.t
9191
def call(conn, opts) do
9292
request_id_header = Keyword.get(opts, :request_id_header, "x-request-id")
93-
request_id = PlugUtils.get_request_id(conn, request_id_header)
9493

95-
%HTTPRequestContext{
96-
request_id: request_id
97-
}
98-
|> Timber.add_context()
94+
case PlugUtils.get_request_id(conn, request_id_header) do
95+
[{_, request_id}] ->
96+
%HTTPRequestContext{
97+
request_id: request_id
98+
}
99+
|> Timber.add_context()
100+
[] ->
101+
:ok
102+
end
99103

100104
conn
101105
end

0 commit comments

Comments
 (0)