This fixes a panic that happened when the incoming request sets the full path with authority (e.g. when using Tonic). The then-formatted URI was incorrect, leading to ParseErrors, which turned into panics.
Testing for the port is enough to determine whether the incoming request has the authority part set, however it does not uses it correctly: it formats the URI to parse as "http://localhost:{port}{uri}" which is incorrect, since urialready contains localhost:{port}, resulting in completely bogus URIs like http://localhost:33593http://localhost:33593/grpc.examples.echo/UnaryEcho.
This completely removes the formatting in case the authority is present, and simply stringifies the incoming URI.
This fixes a panic that happened when the incoming request sets the full path with authority (e.g. when using Tonic). The then-formatted URI was incorrect, leading to ParseErrors, which turned into panics.
Testing for the port is enough to determine whether the incoming request has the authority part set, however it does not uses it correctly: it formats the URI to parse as "http://localhost:{port}{uri}" which is incorrect, since
uri
already containslocalhost:{port}
, resulting in completely bogus URIs likehttp://localhost:33593http://localhost:33593/grpc.examples.echo/UnaryEcho
.This completely removes the formatting in case the authority is present, and simply stringifies the incoming URI.