Class HeaderInterceptor
- java.lang.Object
-
- org.shakespeareframework.retrofit.HeaderInterceptor
-
- All Implemented Interfaces:
okhttp3.Interceptor
public class HeaderInterceptor extends java.lang.Object implements okhttp3.Interceptor
Interceptor
to add headers to any request. This should be used to set authentication or other contextual headers.
-
-
Constructor Summary
Constructors Constructor Description HeaderInterceptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.String key, java.lang.String value)
Adds a header that will be added to the intercepted request.okhttp3.Response
intercept(okhttp3.Interceptor.Chain chain)
void
remove(java.lang.String key)
Removes a header that will no longer be added to the intercepted request.
-
-
-
Method Detail
-
intercept
@Nonnull public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws java.io.IOException
- Specified by:
intercept
in interfaceokhttp3.Interceptor
- Throws:
java.io.IOException
-
add
public void add(java.lang.String key, java.lang.String value)
Adds a header that will be added to the intercepted request.- Parameters:
key
- name of the header to be addedvalue
- value of the header to be added
-
remove
public void remove(java.lang.String key)
Removes a header that will no longer be added to the intercepted request.- Parameters:
key
- name of the header to be removed
-
-