| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
Java built-in HTTP Client integration for Allure Java.
Use this module to capture requests and responses sent through java.net.http.HttpClient as structured HTTP exchange attachments in Allure Report.
Gradle:
dependencies {
testImplementation(platform("io.qameta.allure:allure-bom:<allure-version>"))
testImplementation("io.qameta.allure:allure-java-httpclient")
}Maven, with allure-bom imported in dependency management:
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-java-httpclient</artifactId>
<scope>test</scope>
</dependency>Wrap the client used by your tests with io.qameta.allure.javahttpclient.AllureHttpClient.
HttpClient httpClient = AllureHttpClient.wrap(
HttpClient.newBuilder().build()
);
HttpRequest request = HttpRequest.newBuilder(URI.create("https://example.test/api/items"))
.GET()
.build();
HttpResponse<String> response = httpClient.send(
request,
HttpResponse.BodyHandlers.ofString()
);The wrapper passes calls through unchanged when no Allure test or fixture is running.
Customize redaction and body limits before sharing the client:
HttpClient httpClient = AllureHttpClient.wrap(HttpClient.newHttpClient())
.configureHttpExchange(exchange -> exchange
.redactHeader("X-Api-Key")
.redactQueryParameter("token")
.setMaxBodySize(64 * 1024));Streaming response handlers remain streaming. The attachment contains the response bytes delivered by the time the response future completes; consume or close streaming bodies as required by HttpClient.
| Back | FazBrowse Home | New Git URL |