use of com.bumptech.glide.load.model.Headers in project glide by bumptech.
the class HttpUrlFetcherServerTest method testAppliesHeadersInGlideUrl.
@Test
public void testAppliesHeadersInGlideUrl() throws Exception {
mockWebServer.enqueue(new MockResponse().setResponseCode(200));
String headerField = "field";
String headerValue = "value";
Map<String, String> headersMap = new HashMap<>();
headersMap.put(headerField, headerValue);
Headers headers = mock(Headers.class);
when(headers.getHeaders()).thenReturn(headersMap);
getFetcher(headers).loadData(Priority.HIGH, callback);
assertThat(mockWebServer.takeRequest().getHeader(headerField)).isEqualTo(headerValue);
}
use of com.bumptech.glide.load.model.Headers in project glide by bumptech.
the class VolleyStreamFetcherServerTest method testAppliesHeadersInGlideUrl.
@Test
public void testAppliesHeadersInGlideUrl() throws Exception {
mockWebServer.enqueue(new MockResponse().setResponseCode(200));
String headerField = "field";
String headerValue = "value";
Map<String, String> headersMap = new HashMap<>();
headersMap.put(headerField, headerValue);
Headers headers = mock(Headers.class);
when(headers.getHeaders()).thenReturn(headersMap);
getFetcher(headers).loadData(Priority.HIGH, callback);
waitForResponseLatch.await();
assertThat(mockWebServer.takeRequest().getHeader(headerField)).isEqualTo(headerValue);
}
Aggregations