CustomHeadersInterceptor Class
- java.
lang. Object - com.
microsoft. bot. restclient. interceptors. CustomHeadersInterceptor
- com.
Implements
public final class CustomHeadersInterceptor
implements okhttp3.Interceptor
An instance of this class enables adding custom headers in client requests when added to the okhttp3.OkHttpClient interceptors.
Constructor Summary
| Constructor | Description |
|---|---|
| CustomHeadersInterceptor() |
Initialize an instance of CustomHeadersInterceptor class. |
| CustomHeadersInterceptor(String key, String value) |
Initialize an instance of CustomHeadersInterceptor class. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
Custom |
addHeader(String name, String value)
Add a single header key-value pair. |
|
Custom |
addHeaderMap(Map<String,String> headers)
Add all headers in a header map. |
|
Custom |
addHeaderMultimap(Map<String,List<String>> headers)
Add all headers in a header multimap. |
|
Custom |
addHeaders(Headers headers)
Add all headers in a Headers object. |
| java.util.Map<java.lang.String,java.util.List<java.lang.String>> | headers() |
| okhttp3.Response | intercept(Interceptor.Chain chain) |
|
Custom |
removeHeader(String name)
Remove a header. |
|
Custom |
replaceHeader(String name, String value)
Add a single header key-value pair. |
Methods inherited from java.lang.Object
Constructor Details
CustomHeadersInterceptor
public CustomHeadersInterceptor()
Initialize an instance of CustomHeadersInterceptor class.
CustomHeadersInterceptor
public CustomHeadersInterceptor(String key, String value)
Initialize an instance of CustomHeadersInterceptor class.
Parameters:
Method Details
addHeader
public CustomHeadersInterceptor addHeader(String name, String value)
Add a single header key-value pair. If one with the name already exists, both stay in the header map.
Parameters:
Returns:
addHeaderMap
public CustomHeadersInterceptor addHeaderMap(Map
Add all headers in a header map.
Parameters:
Returns:
addHeaderMultimap
public CustomHeadersInterceptor addHeaderMultimap(Map
Add all headers in a header multimap.
Parameters:
Returns:
addHeaders
public CustomHeadersInterceptor addHeaders(Headers headers)
Add all headers in a Headers object.
Parameters:
Returns:
headers
public Map
Returns:
intercept
public Response intercept(Interceptor.Chain chain)
Parameters:
Throws:
removeHeader
public CustomHeadersInterceptor removeHeader(String name)
Remove a header.
Parameters:
Returns:
replaceHeader
public CustomHeadersInterceptor replaceHeader(String name, String value)
Add a single header key-value pair. If one with the name already exists, it gets replaced.
Parameters:
Returns: