import java.io.IOException;
import br.com.agileprocess.agileroutes.BuildConfig;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
public class UserAgentInterceptor implements Interceptor {
public UserAgentInterceptor() {}
@Override
public Response intercept(Interceptor.Chain chain) throws IOException {
Request original = chain.request();
Request.Builder builder = original.newBuilder()
.addHeader("User-Agent", System.getProperty("http.agent"))
.addHeader("Mobile-Version-Name", BuildConfig.VERSION_NAME)
.addHeader("Mobile-Version-Code", String.valueOf(BuildConfig.VERSION_CODE))
.method(original.method(), original.body());
Request request = builder.build();
return chain.proceed(request);
}
}