@@ -105,21 +105,23 @@ public static Collection<Supplier<TestData>> buildGrids() {
105
105
private TearDownFixture [] fixtures ;
106
106
107
107
private HttpClient .Factory clientFactory ;
108
+ private HttpClient client ;
108
109
109
110
@ Before
110
111
public void setFields () {
111
112
TestData data = values .get ();
112
113
this .server = data .server ;
113
114
this .fixtures = data .fixtures ;
114
115
this .clientFactory = HttpClient .Factory .createDefault ();
116
+ this .client = clientFactory .createClient (server .getUrl ());
115
117
}
116
118
117
119
@ After
118
120
public void stopServers () {
121
+ Safely .safelyCall (client ::close );
119
122
Safely .safelyCall (this .fixtures );
120
123
}
121
124
122
-
123
125
private static TestData createStandalone () {
124
126
StringBuilder rawCaps = new StringBuilder ();
125
127
try (JsonOutput out = new Json ().newOutput (rawCaps )) {
@@ -325,6 +327,8 @@ private static void waitUntilReady(Server<?> server, Duration duration, boolean
325
327
return Boolean .TRUE .equals (status != null &&
326
328
Boolean .parseBoolean (status .get ("ready" ).toString ()));
327
329
});
330
+
331
+ Safely .safelyCall (client ::close );
328
332
}
329
333
330
334
private static void waitUntilReady (Server <?> server , Duration duration ) {
@@ -414,7 +418,6 @@ public void shouldAllowPassthroughForW3CMode() {
414
418
"capabilities" , ImmutableMap .of (
415
419
"alwaysMatch" , ImmutableMap .of ("browserName" , "cheese" )))));
416
420
417
- HttpClient client = clientFactory .createClient (server .getUrl ());
418
421
HttpResponse response = client .execute (request );
419
422
420
423
assertEquals (200 , response .getStatus ());
@@ -452,7 +455,6 @@ public void shouldAllowPassthroughForJWPMode() {
452
455
"desiredCapabilities" , ImmutableMap .of (
453
456
"browserName" , "cheese" ))));
454
457
455
- HttpClient client = clientFactory .createClient (server .getUrl ());
456
458
HttpResponse response = client .execute (request );
457
459
458
460
assertEquals (200 , response .getStatus ());
@@ -479,6 +481,18 @@ public void shouldDoProtocolTranslationFromJWPLocalEndToW3CRemoteEnd() {
479
481
480
482
}
481
483
484
+ @ Test
485
+ public void responseShouldHaveContentTypeAndCacheControlHeaders () {
486
+ HttpClient client = HttpClient .Factory .createDefault ().createClient (server .getUrl ());
487
+
488
+ HttpResponse response = client .execute (new HttpRequest (GET , "/status" ));
489
+
490
+ assertThat (response .getHeader ("Content-Type" ))
491
+ .isEqualTo ("application/json; charset=utf-8" );
492
+ assertThat (response .getHeader ("Cache-Control" ))
493
+ .isEqualTo ("no-cache" );
494
+ }
495
+
482
496
private static class TestData {
483
497
public final Server <?> server ;
484
498
public final TearDownFixture [] fixtures ;
0 commit comments