withBasicAuth

fun OkHttpClient.withBasicAuth(credentials: HttpCredentials?): OkHttpClient

Returns a new client that sends an Authorization header with credentials on every request.

Parameters

credentials

The credentials to include, or null to leave the client unmodified.