Setting :authority with HTTP2 transport
moscicky opened this issue · comments
Jetty Version
12
Jetty Environment
core
Java Version
17
Question
In #5633 a support for setting :authority
header with HttpClient was introduced. The original issue mentions a fluent builder liker API (authority()) for a Request but the linked PR is using sth called HTTPDestination
.
Could you point me to a piece of docs or guide me how to properly use the API? Say I am sending an HTTP2 request to an Envoy proxy running on localhost:5000 and want to include :authority
header set to: foo.bar.baz
The Jetty 12 version of the same testcase is ...
What's the key piece of information is ...
// Setup the destination to physically connect to.
Origin origin = new Origin(scheme, destHost, destPort);
Destination destination = client.resolveDestination(origin);
// What the HTTP request should contain for Authority
var request = client.newRequest(requestHost, requestPort)
.scheme(requestScheme)
.path("/path");
// Initiate the request to the specified destination.
destination.send(request, result -> {
// process the results
});
Great, thanks!