akka / akka-http

The Streaming-first HTTP server/module of Akka
https://doc.akka.io/libraries/akka-http/current/
Other
1.34k stars 594 forks source link

Potential inconsistency in Uri API #1763

Open blemale opened 6 years ago

blemale commented 6 years ago

The different smart constructors to create an akka.http.scaladsl.model.Uri have a different behavior regarding the port normalization.

The apply methods don't normalize the Authority port, unlike the from method:

scala> import akka.http.scaladsl.model.Uri
import akka.http.scaladsl.model.Uri

scala> Uri("http://www.google.fr:80")
res0: akka.http.scaladsl.model.Uri = http://www.google.fr:80

scala> Uri.from(scheme = "http", host = "www.google.fr", port= 80)
res1: akka.http.scaladsl.model.Uri = http://www.google.fr

As a side note Spray was normalizing the port on all Uri smart constructors.

jrudolph commented 6 years ago

Thanks for the report, @blemale. Good point. I agree we should do it consistently.

jiminhsieh commented 6 years ago

Can I try this one? Thanks! :)

jlprat commented 6 years ago

Nobody claimed it till now. So I'd say go for it!

jrudolph commented 6 years ago

First bits merged in #1864.