Skip to content

Commit 3eb0575

Browse files
author
Tomasz Lelek
committed
BAEL-12 userAgent header value in one place
1 parent 34bfeed commit 3eb0575

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

httpclient/src/test/java/org/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ public class HttpClientAdvancedConfiguration {
3838
@Test
3939
public void givenClientWithCustomUserAgentHeader_whenExecuteRequest_shouldReturn200() throws IOException {
4040
//given
41+
String userAgent = "BaeldungAgent/1.0";
4142
serviceMock.stubFor(get(urlEqualTo("/detail"))
42-
.withHeader("User-Agent", equalTo("BaeldungAgent/1.0"))
43+
.withHeader("User-Agent", equalTo(userAgent))
4344
.willReturn(aResponse()
4445
.withStatus(200)));
4546

46-
String userAgent = "BaeldungAgent/1.0";
4747
HttpClient httpClient = HttpClients.createDefault();
4848
final HttpGet httpGet = new HttpGet("http://localhost:8089/detail");
4949
httpGet.setHeader(HttpHeaders.USER_AGENT, userAgent);

0 commit comments

Comments
 (0)