-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
Keep the - of header on init parameter names, otherwise the nested path will not work. #34193
Conversation
@remeio Can you elaborate on which use case you're trying to solve here? |
…path will not work. Signed-off-by: Mengqi Xu <2663479778@qq.com>
efbdf84
to
89a90f1
Compare
@bclozel Hi, I had changed the content of this PR , you can look the test case. I think it's not correct for replace the |
I missed the fact that this was for nested parameters, indeed. Thanks for clarifying that and adding a test case. |
I'm not sure about this change after all. When binding bean properties, the following case will work: class Person() {
// will bind HTTP header "First-Name" : "Jane"
String firstName;
public String getFirstName() {
//
}
public String setFirstName(String firstName) {
//
}
} Constructor binding requires the // will bind HTTP header "First-Name" : "Jane"
record Person(@BindParam("First-Name") String firstName) {
} This PR is about supporting the nested case like so:
The ABNF of RFC7230 allows "." in header names:
But in practice, I'm wondering if we should rely on "." characters in header names. Proxies and CDNs might not accept it. What do you think @rstoyanchev ? |
Indeed, in #32676 we didn't mean to make headers a mechanism for binding to any object structure. The main intent was to include headers in data binding, and those are usually simple, non-hierarchical names. It's similar to what we do for path variables. @remeio is there a specific case with such headers in use that you've come across? |
Hi, There don't have the specific case. I commit this PR just because my code review. In my opinion, I think the handle logic of header and param should be keep the same, it's nice for Spring user, not the coder. You also can close this PR, it's OK. |
Thanks for the feedback. In that case I will close this for now. |
Keep the
-
of header names when init parameter names, otherwise the nested path will not work.@rstoyanchev Hi, for property name and parameter name, I think they should use the same transformed header name using "camelCase".For example, A http request with headers:User-Agent
:something
WWW-Authenticate
:something
Before this PR, the methodExtendedServletRequestValueResolver#initParameterNames
will return a name set:UserAgent
,WWWAuthenticate
After this PR, the method will return a name set:userAgent
,wWWAuthenticate