UserAgentInterceptor Class

  • java.lang.Object
    • com.microsoft.bot.restclient.interceptors.UserAgentInterceptor

Implements

okhttp3.Interceptor

public final class UserAgentInterceptor
implements okhttp3.Interceptor

User agent interceptor for putting a 'User-Agent' header in the request.

Constructor Summary

Constructor Description
UserAgentInterceptor()

Initialize an instance of UserAgentInterceptor class with the default 'User-Agent' header.

Method Summary

Modifier and Type Method and Description
UserAgentInterceptor appendUserAgent(String userAgent)

Append a text to the User-Agent header.

okhttp3.Response intercept(Interceptor.Chain chain)
java.lang.String userAgent()
UserAgentInterceptor withUserAgent(String userAgent)

Overwrite the User-Agent header.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

UserAgentInterceptor

public UserAgentInterceptor()

Initialize an instance of UserAgentInterceptor class with the default 'User-Agent' header.

Method Details

appendUserAgent

public UserAgentInterceptor appendUserAgent(String userAgent)

Append a text to the User-Agent header.

Parameters:

userAgent - the user agent value to append.

Returns:

the user agent interceptor itself

intercept

public Response intercept(Interceptor.Chain chain)

Parameters:

chain

Throws:

java.io.IOException

userAgent

public String userAgent()

Returns:

the current user agent string.

withUserAgent

public UserAgentInterceptor withUserAgent(String userAgent)

Overwrite the User-Agent header.

Parameters:

userAgent - the new user agent value.

Returns:

the user agent interceptor itself

Applies to