8000 Fix order dependence of header values. · codingYogi/async-http-client@c322357 · GitHub
[go: up one dir, main page]

Skip to content

Commit c322357

Browse files
committed
Fix order dependence of header values.
1 parent 81f52b5 commit c322357

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

api/src/test/java/com/ning/http/client/async/AsyncStreamHandlerTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.Arrays;
3030
import java.util.Collection;
3131
import java.util.HashMap;
32+
import java.util.List;
3233
import java.util.Map;
3334
import java.util.concurrent.CountDownLatch;
3435
import java.util.concurrent.Future;
@@ -475,13 +476,20 @@ public Integer onCompleted() throws Exception {
475476
public void asyncOptionsTest() throws Throwable {
476477
final CountDownLatch l = new CountDownLatch(1);
477478
AsyncHttpClient c = getAsyncHttpClient(null);
479+
final String[] expected = {
480+
"GET","HEAD","OPTIONS","POST","TRACE"
481+
};
478482
c.prepareOptions("http://www.apache.org/").execute(new AsyncHandlerAdapter() {
479483

480484
@Override
481485
public STATE onHeadersReceived(HttpResponseHeaders content) throws Exception {
482486
FluentCaseInsensitiveStringsMap h = content.getHeaders();
483487
Assert.assertNotNull(h);
484-
Assert.assertEquals(h.getJoinedValue("Allow", ", "), "GET,HEAD,POST,OPTIONS,TRACE");
488+
String[] values = h.get("Allow").get(0).split(",|, ");
489+
Assert.assertNotNull(values);
490+
Assert.assertEquals(values.length, expected.length);
491+
Arrays.sort(values);
492+
Assert.assertEquals(expected, values);
485493
return STATE.ABORT;
486494
}
487495

0 commit comments

Comments
 (0)
0