Closed jogura closed 4 years ago
As it stands the HttpRequestInterceptor exposed is one of the last pieces of Unirest's leaky apache abstraction. So I'd rather not make that leak bigger. Would you be OK if this interceptor was part of Unirest and not the apache class?
Also, maybe you could give me some ideas of what you would want to do with it? Would you see this as modifying the body in some way? Something created by the object mapper? Consuming and logging the responses? A few examples would be great
any input @jogura ? I'm trying to understand what exactly such a interceptor would do?
3.2.00 now supports a Unirest specific interceptor that has methods for onRequest and onResponse (and a error handler for connection failures)
Is your feature request related to a problem? Please describe. I would like the ability to add a
HttpResponseInterceptor
to preprocess the response. I have a use-case where I'm configuring a "base" URL with standard headers and returning anUnirestInstance
to the client. I would like to use theHttpResponseInterceptor
to put common logic in all responses. So I may not have access to theifSuccess()
method.Describe the solution you'd like The current implementation already supports the ability to add multiple
HttpRequestInterceptors
. The solution would model the same pattern but allow forHttpResponseInterceptors
to theConfig
instance.Alternative You could "intercept" using the
ifSuccess()
method. However, in my particular use-case I don't have access to when theUnirestInstance
is invoked. So I'd like to configure the response interceptor in theConfig
object.