Skip to content

Commit

Permalink
Add Passing Client Headers section to rest-client.adoc
Browse files Browse the repository at this point in the history
  • Loading branch information
pehala committed Apr 1, 2021
1 parent 542cbfa commit 11bb0b6
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion docs/src/main/asciidoc/rest-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ country-api/mp-rest/url=https://restcountries.eu/rest #
country-api/mp-rest/scope=javax.inject.Singleton # /
----


=== Disabling Hostname Verification

To disable the SSL hostname verification for a specific REST client, add the following property to your configuration:
Expand Down Expand Up @@ -557,6 +556,33 @@ public class RequestUUIDHeaderFactory implements ClientHeadersFactory {

Any CDI bean matching the declared factory class will be picked up and can of course benefit from the usual CDI infrastructure.

=== Default header factory
You can also use `@RegisterClientHeaders` annotation without any custom factory specified. In that case the `DefaultClientHeadersFactoryImpl` factory will be used and all headers listed in `org.eclipse.microprofile.rest.client.propagateHeaders` configuration property will be amended. Individual header names are comma-separated.
[source, java]
----
@Path("/v2")
@RegisterRestClient
@RegisterClientHeaders
public interface CountriesService {
@GET
@Path("/name/{name}")
@Produces("application/json")
Set<Country> getByName(@PathParam String name);
@GET
@Path("/name/{name}")
@Produces("application/json")
CompletionStage<Set<Country>> getByNameAsync(@PathParam String name);
}
----

[source,properties]
----
org.eclipse.microprofile.rest.client.propagateHeaders=Authorization,Proxy-Authorization
----

== Package and run the application

Run the application with: `./mvnw compile quarkus:dev`.
Expand Down

0 comments on commit 11bb0b6

Please sign in to comment.