File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -230,7 +230,7 @@ if Code.ensure_loaded?(Plug) do
230230 |> Plug.Conn . fetch_query_params ( )
231231
232232 % {
233- url: " #{ conn . scheme } :// #{ conn . host } : #{ conn . port } #{ conn . request_path } " ,
233+ url: Plug.Conn . request_url ( conn ) ,
234234 method: conn . method ,
235235 data: handle_data ( conn , body_scrubber ) ,
236236 query_string: conn . query_string ,
Original file line number Diff line number Diff line change @@ -198,6 +198,26 @@ defmodule Sentry.PlugTest do
198198 assert body =~ ~s{ "title":"abc-123"}
199199 end
200200
201+ test "request url" do
202+ # Default ports
203+ conn = conn ( :get , "http://www.example.com:80/error_route" )
204+ % { url: url } = Sentry.Plug . build_request_interface_data ( conn , [ ] )
205+ assert url == "http://www.example.com/error_route"
206+
207+ conn = conn ( :get , "https://www.example.com:443/error_route" )
208+ % { url: url } = Sentry.Plug . build_request_interface_data ( conn , [ ] )
209+ assert url == "https://www.example.com/error_route"
210+
211+ # Custom ports
212+ conn = conn ( :get , "http://www.example.com:1234/error_route" )
213+ % { url: url } = Sentry.Plug . build_request_interface_data ( conn , [ ] )
214+ assert url == "http://www.example.com:1234/error_route"
215+
216+ conn = conn ( :get , "https://www.example.com:1234/error_route" )
217+ % { url: url } = Sentry.Plug . build_request_interface_data ( conn , [ ] )
218+ assert url == "https://www.example.com:1234/error_route"
219+ end
220+
201221 defp update_req_cookie ( conn , name , value ) do
202222 req_headers =
203223 conn . req_headers
You can’t perform that action at this time.
0 commit comments