Package com.microsoft.rest.interceptors
Class UserAgentInterceptor
- java.lang.Object
-
- com.microsoft.rest.interceptors.UserAgentInterceptor
-
- All Implemented Interfaces:
okhttp3.Interceptor
public final class UserAgentInterceptor extends Object implements okhttp3.Interceptor
User agent interceptor for putting a 'User-Agent' header in the request.
-
-
Constructor Summary
Constructors Constructor Description UserAgentInterceptor()Initialize an instance ofUserAgentInterceptorclass with the default 'User-Agent' header.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UserAgentInterceptorappendUserAgent(String userAgent)Append a text to the User-Agent header.okhttp3.Responseintercept(okhttp3.Interceptor.Chain chain)StringuserAgent()UserAgentInterceptorwithUserAgent(String userAgent)Overwrite the User-Agent header.
-
-
-
Constructor Detail
-
UserAgentInterceptor
public UserAgentInterceptor()
Initialize an instance ofUserAgentInterceptorclass with the default 'User-Agent' header.
-
-
Method Detail
-
withUserAgent
public UserAgentInterceptor withUserAgent(String userAgent)
Overwrite the User-Agent header.- Parameters:
userAgent- the new user agent value.- Returns:
- the user agent interceptor itself
-
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
-
userAgent
public String userAgent()
- Returns:
- the current user agent string.
-
intercept
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws IOException- Specified by:
interceptin interfaceokhttp3.Interceptor- Throws:
IOException
-
-