Skip to content

Commit 470b2e4

Browse files
committed
better solution to protocols
1 parent 430bff2 commit 470b2e4

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/sentry/plug.ex

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
if Code.ensure_loaded?(Plug) do
2-
if Code.ensure_loaded?(Jason) do
3-
require Protocol
4-
Protocol.derive(Jason.Encoder, Plug.Upload)
5-
end
6-
72
defmodule Sentry.Plug do
83
@default_scrubbed_param_keys ["password", "passwd", "secret"]
94
@default_scrubbed_header_keys ["authorization", "authentication", "cookie"]
@@ -226,7 +221,11 @@ if Code.ensure_loaded?(Plug) do
226221
is_binary(value) && Regex.match?(@credit_card_regex, value) ->
227222
@scrubbed_value
228223

229-
is_map(value) && !Map.has_key?(value, :__struct__) ->
224+
is_map(value) && Map.has_key?(value, :__struct__) ->
225+
Map.from_struct(value)
226+
|> scrub_map()
227+
228+
is_map(value) ->
230229
scrub_map(value)
231230

232231
true ->

0 commit comments

Comments
 (0)