ApiInterceptor implements Interceptor { public static String getAuthorizationHeader(Request request) { return request.header(HEADER_ACCESS_TOKEN); } ApiInterceptor(Authenticator authenticator); @Override Response intercept(Chain chain); static void setAuthorizationHeader(Request.Builder builder, String authorizationHeader); static String getAuthorizationHeader(Request request); final Authenticator authenticator; }
@Test public void testGetAuthorizationHeader() { Request request = new Request.Builder() .url("http: .header(HEADER_ACCESS_TOKEN, "accessToken") .build(); assertEquals("accessToken", ApiInterceptor.getAuthorizationHeader(request)); }