Skip to content
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

Access to request, as well as response headers when response status != 2XX #396

Closed
colsson11 opened this issue May 25, 2016 · 9 comments
Closed
Labels
documentation Issues that require updates to our documentation enhancement For recommending new capabilities help wanted Issues we need help with tackling

Comments

@colsson11
Copy link

Hi there,

I would like to be able to log the full request, including headers, in addition to response, when a response returns something other than 2XX, to be able to fully debug what is going on.

I can turn on logging, but as far as I can tell in feign.SynchronousMethodHandler , it's not possible to get it to only log in the case of failed requests. Logging all requests will mean a lot of noise.

Another option would be if the errorDecoder method feign.codec.ErrorDecoder.decode got the request passed in as well, so this could be used in a custom ErrorDecoder. A potential difficulty here would be to make this backwards compatible.

Are you open for a pull request addressing this in either way above, or maybe there is some way to achieve this that I've overlooked?

Cheers,

Christian

@codefromthecrypt
Copy link
Contributor

This topic has come up a few times, and usually ends when I ask someone to review the history first :)

Have a look through #290? If you can take the conversation forward with that in mind.. all ears!

@colsson11
Copy link
Author

Thanks Adrian, #290 sounds reasonable as far as I understand it.

But what about changing the signature of feign.codec.ErrorDecoder.decode to Exception decode(Request request, Response response); ? Then implementors would have access to the full request for e.g. logging purposes, or using in a resulting exception.
I think it should be possible to do this in a backwards compatible fashion in Java 8, with the use of a default forwarding implementation of the original method, but it seems like the source version is at 1.6 currently..

@codefromthecrypt
Copy link
Contributor

codefromthecrypt commented Jun 3, 2016 via email

@colsson11
Copy link
Author

Thanks, yeah I guess when the times comes for a major version upgrade, either of these would be nice :)

@spencergibb
Copy link
Contributor

fwiw, spring cloud won't move to java 8 until spring 5 and boot 2

@davejwilson
Copy link

is this still a limitation of feign?

@spencergibb
Copy link
Contributor

@davejwilson yes

@kdavisk6
Copy link
Member

see #744 for an update on this. The Request will be available, albeit sans body, on the Response.

@kdavisk6 kdavisk6 added enhancement For recommending new capabilities help wanted Issues we need help with tackling documentation Issues that require updates to our documentation labels Sep 14, 2018
@kdavisk6
Copy link
Member

kdavisk6 commented May 28, 2019

Closed via #744

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issues that require updates to our documentation enhancement For recommending new capabilities help wanted Issues we need help with tackling
Projects
None yet
Development

No branches or pull requests

5 participants