|
16 | 16 | package org.asynchttpclient;
|
17 | 17 |
|
18 | 18 | import static org.asynchttpclient.Dsl.*;
|
19 |
| -import static org.asynchttpclient.test.TestUtils.TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET; |
| 19 | +import static org.asynchttpclient.test.TestUtils.*; |
20 | 20 | import static org.testng.Assert.*;
|
21 | 21 | import io.netty.handler.codec.http.HttpHeaders;
|
22 | 22 |
|
23 | 23 | import java.util.Arrays;
|
24 |
| -import java.util.Locale; |
25 | 24 | import java.util.concurrent.CountDownLatch;
|
26 | 25 | import java.util.concurrent.Future;
|
27 | 26 | import java.util.concurrent.TimeUnit;
|
@@ -68,7 +67,7 @@ public void onThrowable(Throwable t) {
|
68 | 67 |
|
69 | 68 | HttpHeaders h = responseHeaders.get();
|
70 | 69 | assertNotNull(h, "No response headers");
|
71 |
| - assertEquals(h.get(HttpHeaders.Names.CONTENT_TYPE), TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET, "Unexpected content-type"); |
| 70 | + assertContentTypesEquals(h.get(HttpHeaders.Names.CONTENT_TYPE), TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET); |
72 | 71 | assertNull(throwable.get(), "Unexpected exception");
|
73 | 72 | }
|
74 | 73 | }
|
@@ -106,7 +105,7 @@ public String onCompleted() throws Exception {
|
106 | 105 | String responseBody = f.get(10, TimeUnit.SECONDS);
|
107 | 106 | HttpHeaders h = responseHeaders.get();
|
108 | 107 | assertNotNull(h);
|
109 |
| - assertEquals(h.get(HttpHeaders.Names.CONTENT_TYPE), TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET); |
| 108 | + assertContentTypesEquals(h.get(HttpHeaders.Names.CONTENT_TYPE), TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET); |
110 | 109 | assertEquals(responseBody, RESPONSE);
|
111 | 110 | }
|
112 | 111 | }
|
@@ -147,7 +146,7 @@ public void onThrowable(Throwable t) {
|
147 | 146 | assertTrue(!bodyReceived.get(), "Interrupted not working");
|
148 | 147 | HttpHeaders h = responseHeaders.get();
|
149 | 148 | assertNotNull(h, "Should receive non null headers");
|
150 |
| - assertEquals(h.get(HttpHeaders.Names.CONTENT_TYPE).toLowerCase(Locale.ENGLISH), TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET.toLowerCase(Locale.ENGLISH), "Unexpected content-type"); |
| 149 | + assertContentTypesEquals(h.get(HttpHeaders.Names.CONTENT_TYPE), TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET); |
151 | 150 | assertNull(throwable.get(), "Should get an exception");
|
152 | 151 | }
|
153 | 152 | }
|
@@ -186,7 +185,7 @@ public void onThrowable(Throwable t) {
|
186 | 185 | String responseBody = f.get(5, TimeUnit.SECONDS);
|
187 | 186 | HttpHeaders h = responseHeaders.get();
|
188 | 187 | assertNotNull(h, "Should receive non null headers");
|
189 |
| - assertEquals(h.get(HttpHeaders.Names.CONTENT_TYPE).toLowerCase(Locale.ENGLISH), TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET.toLowerCase(Locale.ENGLISH), "Unexpected content-type"); |
| 188 | + assertContentTypesEquals(h.get(HttpHeaders.Names.CONTENT_TYPE), TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET); |
190 | 189 | assertNotNull(responseBody, "No response body");
|
191 | 190 | assertEquals(responseBody.trim(), RESPONSE, "Unexpected response body");
|
192 | 191 | assertNull(throwable.get(), "Unexpected exception");
|
@@ -256,7 +255,7 @@ public String onCompleted() throws Exception {
|
256 | 255 | String r = f.get(5, TimeUnit.SECONDS);
|
257 | 256 | HttpHeaders h = responseHeaders.get();
|
258 | 257 | assertNotNull(h, "Should receive non null headers");
|
259 |
| - assertEquals(h.get(HttpHeaders.Names.CONTENT_TYPE).toLowerCase(Locale.ENGLISH), TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET.toLowerCase(Locale.ENGLISH), "Unexpected content-type"); |
| 258 | + assertContentTypesEquals(h.get(HttpHeaders.Names.CONTENT_TYPE), TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET); |
260 | 259 | assertNotNull(r, "No response body");
|
261 | 260 | assertEquals(r.trim(), RESPONSE, "Unexpected response body");
|
262 | 261 |
|
@@ -287,7 +286,7 @@ public String onCompleted() throws Exception {
|
287 | 286 | f.get(5, TimeUnit.SECONDS);
|
288 | 287 | h = responseHeaders.get();
|
289 | 288 | assertNotNull(h, "Should receive non null headers");
|
290 |
| - assertEquals(h.get(HttpHeaders.Names.CONTENT_TYPE).toLowerCase(Locale.ENGLISH), TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET.toLowerCase(Locale.ENGLISH), "Unexpected content-type"); |
| 289 | + assertContentTypesEquals(h.get(HttpHeaders.Names.CONTENT_TYPE), TEXT_HTML_CONTENT_TYPE_WITH_UTF_8_CHARSET); |
291 | 290 | assertNotNull(r, "No response body");
|
292 | 291 | assertEquals(r.trim(), RESPONSE, "Unexpected response body");
|
293 | 292 | }
|
|
0 commit comments