feign
feign copied to clipboard
RequestTemplate.path() doesn't return a stable value in RequestInterceptor.apply when retry
first time to run, RequestTemplate.path() resturns a value without "target"
public String path() {
StringBuilder path = new StringBuilder();
if (this.target != null) { //this.target is null
path.append(this.target);
}
}
it returns like '/api/v4/spot/accounts'
when retry triggered:
public String path() {
StringBuilder path = new StringBuilder();
if (this.target != null) { //this.target is not null
path.append(this.target);
}
}
it returns like 'https://api.gateio.ws/api/v4/spot/accounts'
Ow dear, this is another side effect of RequestTemplate
been mutable
HardCodedTarget
does change the path
if path
doesn't contain http
on it....
Oddly enough, if you are using a feign client to talk with a ftp://
it will include the url
over, and over, and over again...
the only solution I could think to have a MORE consistent result, would be to expose a new method called relativePath()
and that would return this.uriTemplate.toString()
Lemme know if that would solve your issue, and push a PR for this change
thank you,the value of this.uriTemplate.toString()
is what i need
Looks like you got what you needed. 👍🏻