Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introducing Interceptor's concept into Fuel. There are two types of interceptors which are
RequestInterceptor
andResponseInterceptor
.RequestInterceptor
is in type of(Request) -> Request) -> ((Request) -> Request)
.Simple usage of RequestInterceptor is
cUrlLoggingInterceptor
can be simply implemented as suchAnd usage will be
next
is a way to let user customize the behavior of interceptor even more. Without callingnext
, next interceptor chain will not be called.For
ResponseInterceptor
, it is in type of(Request, Response) -> Response -> (Request, Response) -> Response
. This makes Redirection to be supported with one type of ResponseInterceptor by checking whether Response type is either301
or302
. Then, re-request with new URL in location header.