-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Response Interceptors #1126
Comments
Short answer is cause nobody implemented it. As workaround, you could use a customized decoded to validate your response and then delegate decoding to whatever decoder you need. |
I also could use a response interceptor: my use case is to capture some response headers and run some logic on them, possibly only if the response is successful (e.g. only when the status is 200 and the decoding throws no exceptions). What would be the appropriate place to do such change, design-wise? |
Just to give us a little extra flexibility =) So, Now, what are you trying to do that you can't do by chain decoders?
|
How can i send another request when response in some status, and then retry request. The steps like this.
|
I've updated the title of this issue to better reflect the ask and added the proposal label. If this receives enough support we will consider this enhancement. |
This would be a great feature if we can get it. |
I too have a use case where I can leverage ResponseInterceptor functionality. Will be good to see this implemented, instead of performing a workaround. |
I too have a need for this kind of functionality even though my work around is working as well. The response interceptor just would need to happen before decoder. In this case all data is moved around in encrypted string so it is needed to be decrypted before say GsonDecoder can access and decode the json. My current decryption decoder is like so if someone finds it useful: `public class GsonDecryptionDecoder extends GsonDecoder {
}` |
I also need ResponseInterceptor, especially because decoder workaround is not usable for me - the decoder is not called for methods returning void. I need to validate response headers and ignore the response if it does not contain certain header. |
Hi @kdavisk6 , I need to catch a header datum in Response to validate it. The following solution is working, but It is ugly. Instead of this I want to write ResponseInterceptor to catch the header rate-limit datum. At the moment, I appreciate any workaround helps.
Huge thnx |
We are open to evaluating any proposals for this. Feel free to open a PR and tag me to review. |
* add ResponseInterceptor support #1126 * Add the license header. Add the license header. Co-authored-by: Dewald de Jager <DewaldDeJager@users.noreply.github.com> * small fix for license header * fix format issue * combine before and after method to one aroundDecode method * Change ResponseInterceptor to use InvocationContext Co-authored-by: Fei,Yanke <yanke.fei@mosi-tech.com> Co-authored-by: feiyanke <feiyanke@126.com> Co-authored-by: Dewald de Jager <DewaldDeJager@users.noreply.github.com>
Would be good to also be able to throw custom exceptions from decoder or response interceptor, currently all exceptions get wrapped in DecodeException. |
* add ResponseInterceptor support #1126 * Add the license header. Add the license header. Co-authored-by: Dewald de Jager <DewaldDeJager@users.noreply.github.com> * small fix for license header * fix format issue * combine before and after method to one aroundDecode method * Change ResponseInterceptor to use InvocationContext Co-authored-by: Fei,Yanke <yanke.fei@mosi-tech.com> Co-authored-by: feiyanke <feiyanke@126.com> Co-authored-by: Dewald de Jager <DewaldDeJager@users.noreply.github.com>
* add ResponseInterceptor support #1126 * Add the license header. Add the license header. Co-authored-by: Dewald de Jager <DewaldDeJager@users.noreply.github.com> * small fix for license header * fix format issue * combine before and after method to one aroundDecode method * Change ResponseInterceptor to use InvocationContext Co-authored-by: Fei,Yanke <yanke.fei@mosi-tech.com> Co-authored-by: feiyanke <feiyanke@126.com> Co-authored-by: Dewald de Jager <DewaldDeJager@users.noreply.github.com>
In my project, I use the request interceptor to sign the request. I thought that there would be a corresponding response interceptor to verify the signature, but I didn't find it. Is there a better way?
The text was updated successfully, but these errors were encountered: