@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); }
@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); }
private DataFetcher<InputStream> getFetcher() { return getFetcher(Headers.DEFAULT); }
private DataFetcher<InputStream> getFetcher(Headers headers) { URL url = mockWebServer.url(DEFAULT_PATH).url(); return new VolleyStreamFetcher(requestQueue, new GlideUrl(url.toString(), headers)); }
private HttpUrlFetcher getFetcher() { return getFetcher(Headers.DEFAULT); }
private HttpUrlFetcher getFetcher(Headers headers) { URL url = mockWebServer.url(DEFAULT_PATH).url(); return new HttpUrlFetcher(new GlideUrl(url, headers), TIMEOUT_TIME_MS, HttpUrlFetcher.DEFAULT_CONNECTION_FACTORY); }
public AvatarUrl(URL url, Headers headers) { super(url, headers); }
public AvatarUrl(String url, Headers headers) { super(url, headers); }
public ForcePassUrl(URL url, Headers headers) { super(url, headers); }
public ForcePassUrl(String url, Headers headers) { super(url, headers); }
@Override protected Headers getHeaders(Attachment model, int width, int height) { String token = PreferenceManager.getDefaultSharedPreferences(context).getString(context.getString(mil.nga.giat.mage.sdk.R.string.tokenKey), null); return new LazyHeaders.Builder().addHeader("Authorization", "Bearer " + token).build(); }
/** * Returns the headers for the given model and dimensions as a map of strings to sets of strings, * or null if no headers should be added. * * @param model The model. * @param width The width in pixels of the view/target the image will be loaded into. * @param height The height in pixels of the view/target the image will be loaded into. */ // Public API. @SuppressWarnings({"unused", "WeakerAccess"}) @Nullable protected Headers getHeaders(Model model, int width, int height, Options options) { return Headers.DEFAULT; }
/** * Returns the headers for the given model and dimensions as a map of strings to sets of strings, * or null if no headers should be added. * * @param model The model. * @param width The width in pixels of the view/target the image will be loaded into. * @param height The height in pixels of the view/target the image will be loaded into. */ @Nullable protected Headers getHeaders(Model model, int width, int height, Options options) { return Headers.DEFAULT; }