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

Can't set request header in json format #2252

Closed
hyfsy opened this issue Nov 30, 2023 · 5 comments · Fixed by #2471
Closed

Can't set request header in json format #2252

hyfsy opened this issue Nov 30, 2023 · 5 comments · Fixed by #2471

Comments

@hyfsy
Copy link

hyfsy commented Nov 30, 2023

image

@hyfsy
Copy link
Author

hyfsy commented Nov 30, 2023

spring-cloud-starter-openfeign: 3.1.4
feign-core: 11.8

@lquterqtd
Copy link

lquterqtd commented Dec 7, 2023

{"a":"b""c"}
这不是一个合法的json格式吧?
试试{"a":"b""c"}
以{开始的header,feign会认为是表达式,会按照
https://datatracker.ietf.org/doc/html/rfc6570#section-3.2.2
的规则处理的

@hyfsy
Copy link
Author

hyfsy commented Dec 8, 2023

Regardless of whether the json format is correct or not, the example I gave above already shows that the header has been parsed as the wrong string, my problem is that the header should support json format, and should not be parsed as a template even if it has {}. In addition, the link you gave is the URI Template specification, not the HTTP Header specification which is showed here: https://datatracker.ietf.org/doc/html/rfc2616#section-4.2

@raizoor
Copy link

raizoor commented Dec 13, 2023

@hyfsy

Please see that -> #1987

It seems the same problem..

@hyfsy
Copy link
Author

hyfsy commented Dec 14, 2023

It's the same problem, but it hasn't been solved

dvag-yannick-reifschneider added a commit to dvag-yannick-reifschneider/feign that referenced this issue Jul 10, 2024
This change adds a new method RequestTemplate#headerLiteral which allows adding headers which are not interpreted as Template expressions. This allows adding empty JSON objects to headers in RequestInterceptor implementations.

Fixes OpenFeign#2252, OpenFeign#1987
@velo velo closed this as completed in 005619f Jul 10, 2024
velo added a commit that referenced this issue Oct 7, 2024
* Allows adding literal header values to RequestTemplate

This change adds a new method RequestTemplate#headerLiteral which allows adding headers which are not interpreted as Template expressions. This allows adding empty JSON objects to headers in RequestInterceptor implementations.

Fixes #2252, #1987

* Update RequestTemplate.java

---------

Co-authored-by: Marvin <[email protected]>
velo added a commit that referenced this issue Oct 8, 2024
* Allows adding literal header values to RequestTemplate

This change adds a new method RequestTemplate#headerLiteral which allows adding headers which are not interpreted as Template expressions. This allows adding empty JSON objects to headers in RequestInterceptor implementations.

Fixes #2252, #1987

* Update RequestTemplate.java

---------

Co-authored-by: Marvin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants