@@ -68,6 +68,7 @@ public class MockServer {
68
68
public static final String ERROR_RESPONSE = HOST + "/error" ;
69
69
public static final String DELETE = HOST + "/delete" ;
70
70
public static final String GZIP = HOST + "/gzip" ;
71
+ public static final String EMPTY_GZIP = HOST + "/empty-gzip" ;
71
72
public static final String PATCH = HOST + "/patch" ;
72
73
public static final String INVALID_REQUEST = HOST + "/invalid" ;
73
74
public static final String PASSED_PATH_PARAM = GET + "/{params}/passed" ;
@@ -98,6 +99,7 @@ public static void reset(){
98
99
post ("/post" , MockServer ::jsonResponse );
99
100
get ("/get" , MockServer ::jsonResponse );
100
101
get ("/gzip" , MockServer ::gzipResponse );
102
+ post ("/empty-gzip" , MockServer ::emptyGzipResponse );
101
103
get ("/redirect" , MockServer ::redirect );
102
104
patch ("/patch" , MockServer ::jsonResponse );
103
105
get ("/invalid" , MockServer ::inValid );
@@ -193,6 +195,14 @@ private static Object inValid(Request request, Response response) {
193
195
return "You did something bad" ;
194
196
}
195
197
198
+ private static Object emptyGzipResponse (Request request , Response response ) throws Exception {
199
+ response .raw ().setHeader ("Content-Encoding" , "gzip" );
200
+ response .raw ().setContentType ("application/json" );
201
+ response .raw ().setStatus (200 );
202
+ response .raw ().getOutputStream ().close ();
203
+ return null ;
204
+ }
205
+
196
206
private static Object gzipResponse (Request request , Response response ) {
197
207
response .header ("Content-Encoding" , "gzip" );
198
208
return jsonResponse (request , response );
@@ -248,7 +258,7 @@ public static void expectedPages(int expected) {
248
258
}
249
259
250
260
public static void main (String [] args ){
251
-
261
+
252
262
}
253
263
254
264
public static void expectCookie (String name , String value ) {
0 commit comments