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
Add response headers to FeignException #1452
Add response headers to FeignException #1452
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be great if @pzapasni and @virtual-machinist left some comment.
Can you please also add headers to |
I am OK with this but looks like it takes more time: there are a lot of calls of the method |
Ah, I see what you mean. However no But perhaps you're right and it's better to do this addition as a follow-up in a separate issue. |
@velo && @kdavisk6 how about remove some constructors and do not use the parameter response body as prepared byte array but use the response? Proposal constructors of FeignException:
The reading of response body move to an utility method that hides possible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is a good improvement overall.
Could you please just file a ticket to simplify FeignException
?
Ideally it should have one constructor for Request
and one for Response
. I'm sure it's more complicated than that.
@@ -29,6 +29,7 @@ | |||
|
|||
<properties> | |||
<main.basedir>${project.basedir}/..</main.basedir> | |||
<hamcrest.version>1.3</hamcrest.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this to the parent pom?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, there is a hamcrest 2.0 somewhere, would prefer to go with that one
super(message); | ||
this.status = status; | ||
this.responseBody = responseBody; | ||
this.responseHeaders = caseInsensitiveCopyOf(responseHeaders); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think FeignException
should re-order response headers. It may make sense to sort it, sure, but not here.
@@ -40,6 +40,7 @@ | |||
private static final long serialVersionUID = 0; | |||
private int status; | |||
private byte[] responseBody; | |||
private Map<String, Collection<String>> responseHeaders; | |||
private Request request; | |||
|
|||
protected FeignException(int status, String message, Throwable cause) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this exception is getting more and more complicated.... wondering if we should have one constructor that takes Request
as argument and the other one that takes Response
Anyway, just concerned that this class is getting more and more complicated.
Implementation of #1268
This PR adds the ability to retrieve the response headers from a
FeignException
.This is replacement for #1277 as the source branch is gone.