All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.specto.hoverfly.junit.api.AuthHeaderInterceptor Maven / Gradle / Ivy

There is a newer version: 0.19.1
Show newest version
package io.specto.hoverfly.junit.api;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;

class AuthHeaderInterceptor implements Interceptor {

    private final String authToken;

    AuthHeaderInterceptor(String authToken) {
        this.authToken = authToken;
    }

    @Override
    public Response intercept(Chain chain) throws IOException {
        Request originalRequest = chain.request();

        Request request = originalRequest.newBuilder().addHeader("Authorization", "Bearer " + authToken).build();
        return chain.proceed(request);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy