Truncated JSON header value with @Headers
Observed on versions: 11.2, 11.4 Not reproducible on version: 10.1.0
When passing a JSON string as @Param to @Headers the string gets truncated.
Example:
{"some": "value", "other": "value"}
Gets truncated to:
{"some": "value", "other"}
Code to reproduce: https://github.com/daczczcz1/feign-bug-reproduction
We've run into this as well (using the RequestTemplate.header() method, but I'm guessing still hits the same templating logic as @Headers). Escaping the braces using percent encoding or double bracing ({{) doesn't help, as the content is not unescaped when it lands on the wire.
The annotation based @Header should be different from the .header(...) method. A solution could be a .headerRaw(...) method.
This breaks our code. We're adding a custom JSON structure to a HEADER which now gets truncated. Please add another method as suggested above which adds a plain string as value without parsing
Same problem here with the @RequestHeader annotation of spring-cloud-starter-openfeign library. The 3.1.1 version uses feign-core 11.8.
Ran into this today after upgrading from an older version to 11.8
Any solution to this problem? We are blocked.
any update?
Blocked by the same problem. Any update or a workaround to resolve this please.
Hi @suryamurali1991 looking for volunteers to help fixing this issue.
@velo I've seen the PR was close, any chance the issue gonna be attended soon?
@SikoraAdam it's still waiting for someone to make the necessary changes. I'm willing to review it and get the release out of the door. Feel free to take a look on the comments we left at the PR and make the necessary changes
I confirm that we are also impacted by this issue. I have temporarely forced our project to get the 10.12 version to make it work.
Same problem for us. To sidestep it temporarily we're pulling in feign-core 11.0
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<version>11.0</version>
</dependency>
I ran a git bisect on this issue and narrowed it down to the following commit: f8ad8670e3dc73862f52eec475464a301e8c41cc
That commit did some much needed work. No way to revert it. The issue is not in the HeaderTemplate expand function, nor is it in the Expression or Simple Expression code. As far as I can see the RequestTemplate appears to be expanding the header template more than once. Resulting in an expression being expanded to JSON and then the Json being treated as a template and the Expression expansion going off the rails there.
I have a fork and commit with the duplication unit tests here: https://github.com/JKomoroski/feign/commit/0f686eb78b5fe40b6569eb7fa44e8ab1040e7a7e
Working on a sensible fix.
Could you please let me know if this fix has been released?
Could you please let me know if this fix has been released? Yes it was. https://github.com/OpenFeign/feign/releases/tag/12.0
Could you please let me know if this fix has been released? Yes it was. https://github.com/OpenFeign/feign/releases/tag/12.0
Thank you.