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

com.vanniktech.maven.publish.nexus.NexusOkHttpInterceptor.kt Maven / Gradle / Ivy

Go to download

Gradle plugin that configures publish tasks to automatically upload all of your Java, Kotlin, Gradle, or Android libraries to any Maven instance.

There is a newer version: 0.29.0
Show newest version
package com.vanniktech.maven.publish.nexus

import okhttp3.Credentials
import okhttp3.Interceptor
import okhttp3.Response

class NexusOkHttpInterceptor(val username: String, val password: String) : Interceptor {
  override fun intercept(chain: Interceptor.Chain): Response {
    val requestBuilder = chain.request().newBuilder()

    requestBuilder.addHeader("Accept", "application/json") // request json by default, XML is returned else
    requestBuilder.addHeader("Authorization", Credentials.basic(username, password))

    return chain.proceed(requestBuilder.build())
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy