Skip to content

Commit

Permalink
WIP: try decoding values when replacing
Browse files Browse the repository at this point in the history
  • Loading branch information
GregMefford committed Nov 6, 2018
1 parent 694e87b commit d676199
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/spandex_phoenix/tracer.ex
Expand Up @@ -243,6 +243,11 @@ defmodule SpandexPhoenix.Tracer do

# Phoenix doesn't set the plug_route for us, so we have to figure it out ourselves
defp route_name(%Plug.Conn{path_params: path_params, request_path: request_path}) do
Enum.reduce(path_params, request_path, fn {key, value}, acc -> String.replace(acc, value, ":#{key}") end)
Enum.reduce(path_params, request_path, &replace_decoded/2)
end

defp replace_decoded({key, value}, acc) do
decoded = URI.decode_www_form(value)
String.replace(acc, decoded, ":#{key}")
end
end

0 comments on commit d676199

Please sign in to comment.