use of mockwebserver3.RecordedRequest in project okhttp by square.
the class CookiesTest method testQuoteStripping.
@Test
public void testQuoteStripping() throws Exception {
client = client.newBuilder().cookieJar(new JavaNetCookieJar(new CookieManager() {
@Override
public Map<String, List<String>> get(URI uri, Map<String, List<String>> requestHeaders) {
Map<String, List<String>> result = new LinkedHashMap<>();
result.put("COOKIE", Collections.singletonList("Bar=\""));
result.put("cooKIE2", Collections.singletonList("Baz=\"baz\""));
return result;
}
})).build();
server.enqueue(new MockResponse());
get(server.url("/"));
RecordedRequest request = server.takeRequest();
assertThat(request.getHeader("Cookie")).isEqualTo("Bar=\"; Baz=baz");
assertThat(request.getHeader("Cookie2")).isNull();
assertThat(request.getHeader("Quux")).isNull();
}
Aggregations