BAEL-12 userAgent header value in one place
This commit is contained in:
parent
34bfeed011
commit
3eb0575708
|
@ -38,12 +38,12 @@ public class HttpClientAdvancedConfiguration {
|
||||||
@Test
|
@Test
|
||||||
public void givenClientWithCustomUserAgentHeader_whenExecuteRequest_shouldReturn200() throws IOException {
|
public void givenClientWithCustomUserAgentHeader_whenExecuteRequest_shouldReturn200() throws IOException {
|
||||||
//given
|
//given
|
||||||
|
String userAgent = "BaeldungAgent/1.0";
|
||||||
serviceMock.stubFor(get(urlEqualTo("/detail"))
|
serviceMock.stubFor(get(urlEqualTo("/detail"))
|
||||||
.withHeader("User-Agent", equalTo("BaeldungAgent/1.0"))
|
.withHeader("User-Agent", equalTo(userAgent))
|
||||||
.willReturn(aResponse()
|
.willReturn(aResponse()
|
||||||
.withStatus(200)));
|
.withStatus(200)));
|
||||||
|
|
||||||
String userAgent = "BaeldungAgent/1.0";
|
|
||||||
HttpClient httpClient = HttpClients.createDefault();
|
HttpClient httpClient = HttpClients.createDefault();
|
||||||
final HttpGet httpGet = new HttpGet("http://localhost:8089/detail");
|
final HttpGet httpGet = new HttpGet("http://localhost:8089/detail");
|
||||||
httpGet.setHeader(HttpHeaders.USER_AGENT, userAgent);
|
httpGet.setHeader(HttpHeaders.USER_AGENT, userAgent);
|
||||||
|
|
Loading…
Reference in New Issue