public final class UserAgentInterceptor extends Object implements okhttp3.Interceptor
| Constructor and Description |
|---|
UserAgentInterceptor()
Initialize an instance of
UserAgentInterceptor class with the default
'User-Agent' header. |
| Modifier and Type | Method and Description |
|---|---|
UserAgentInterceptor |
appendUserAgent(String userAgent)
Append a text to the User-Agent header.
|
okhttp3.Response |
intercept(okhttp3.Interceptor.Chain chain) |
String |
userAgent() |
UserAgentInterceptor |
withUserAgent(String userAgent)
Overwrite the User-Agent header.
|
public UserAgentInterceptor()
UserAgentInterceptor class with the default
'User-Agent' header.public UserAgentInterceptor withUserAgent(String userAgent)
userAgent - the new user agent value.public UserAgentInterceptor appendUserAgent(String userAgent)
userAgent - the user agent value to append.public String userAgent()
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain)
throws IOException
intercept in interface okhttp3.InterceptorIOExceptionCopyright © 2019. All rights reserved.