elixir-plug / plug

Compose web applications with functions
https://hex.pm/packages/plug
Other
2.88k stars 587 forks source link

Allow to specify a port from the conn #1187

Closed kpanic closed 11 months ago

kpanic commented 1 year ago

Hey there 👋🏾

Currently the port can be specified by an URI like http://localhost:4200 but in phoenix it's required to do a:

get(conn, "http://localhost:42000/my/path", ...)

Because we do an URI.parse/1 here https://github.com/elixir-plug/plug/blob/main/lib/plug/adapters/test/conn.ex#L9

Instead the port in the conn struct could be change and that should be cleaner rather than specifing a full URI, in phoenix tests.

Thanks for creating Plug!!

PS: Hope that this PR makes sense 😉

josevalim commented 11 months ago

:green_heart: :blue_heart: :purple_heart: :yellow_heart: :heart: