@Test public void testAddAuthHeader() { RestClient restClient = new RestClient(endpoint, HttpAsyncClients.createDefault(), "shared-secret"); HttpUriRequest request = new HttpGet(endpoint + path); request = restClient.addAuthHeader(request); assertEquals(request.getHeaders(RestClient.AUTHORIZATION_HEADER)[0].toString(), RestClient.AUTHORIZATION_HEADER + ": " + RestClient.AUTHORIZATION_METHOD + "shared-secret"); }
@VisibleForTesting protected HttpUriRequest addAuthHeader(HttpUriRequest request) { if (sharedSecret != null) { request.addHeader(AUTHORIZATION_HEADER, AUTHORIZATION_METHOD + sharedSecret); } return request; }
RestClient { @VisibleForTesting protected HttpUriRequest addAuthHeader(HttpUriRequest request) { if (sharedSecret != null) { request.addHeader(AUTHORIZATION_HEADER, AUTHORIZATION_METHOD + sharedSecret); } return request; } }
RestClient { @VisibleForTesting protected HttpUriRequest addAuthHeader(HttpUriRequest request) { if (sharedSecret != null) { request.addHeader(AUTHORIZATION_HEADER, AUTHORIZATION_METHOD + sharedSecret); } return request; } RestClient(String target, CloseableHttpAsyncClient asyncClient);  RestClient(String target, CloseableHttpAsyncClient asyncClient, String sharedSecret);  RestClient(String target, CloseableHttpAsyncClient asyncClient, HttpClient mockHttpClient); }
RestClient { @VisibleForTesting protected HttpUriRequest addAuthHeader(HttpUriRequest request) { if (sharedSecret != null) { request.addHeader(AUTHORIZATION_HEADER, AUTHORIZATION_METHOD + sharedSecret); } return request; } RestClient(String target, CloseableHttpAsyncClient asyncClient);  RestClient(String target, CloseableHttpAsyncClient asyncClient, String sharedSecret);  RestClient(String target, CloseableHttpAsyncClient asyncClient, HttpClient mockHttpClient); HttpResponse perform(final Method method, final String path, final HttpEntity payload); Future<HttpResponse> performAsync(final Method method, final String path, final HttpEntity payload,
                                           final FutureCallback<HttpResponse> responseHandler); void checkResponse(HttpResponse httpResponse, int expected); T parseHttpResponse(HttpResponse response, TypeReference<T> classType); HttpResponse upload(String path, String inputFileName, Map<String, String> arguments); HttpResponse upload(String path, FileBody fileBody, Map<String, String> arguments); }
RestClient { @VisibleForTesting protected HttpUriRequest addAuthHeader(HttpUriRequest request) { if (sharedSecret != null) { request.addHeader(AUTHORIZATION_HEADER, AUTHORIZATION_METHOD + sharedSecret); } return request; } RestClient(String target, CloseableHttpAsyncClient asyncClient);  RestClient(String target, CloseableHttpAsyncClient asyncClient, String sharedSecret);  RestClient(String target, CloseableHttpAsyncClient asyncClient, HttpClient mockHttpClient); HttpResponse perform(final Method method, final String path, final HttpEntity payload); Future<HttpResponse> performAsync(final Method method, final String path, final HttpEntity payload,
                                           final FutureCallback<HttpResponse> responseHandler); void checkResponse(HttpResponse httpResponse, int expected); T parseHttpResponse(HttpResponse response, TypeReference<T> classType); HttpResponse upload(String path, String inputFileName, Map<String, String> arguments); HttpResponse upload(String path, FileBody fileBody, Map<String, String> arguments); static final String AUTHORIZATION_HEADER; static final String AUTHORIZATION_METHOD; }