-
Notifications
You must be signed in to change notification settings - Fork 37.7k
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
Fix parameter bug of handler that Kotlin DSL defines as a parameter for the filterFunction. #26857
Closed
ShindongLee
wants to merge
3
commits into
spring-projects:main
from
ShindongLee:bugfix/handler-function-parameter-bugfix
Closed
Fix parameter bug of handler that Kotlin DSL defines as a parameter for the filterFunction. #26857
ShindongLee
wants to merge
3
commits into
spring-projects:main
from
ShindongLee:bugfix/handler-function-parameter-bugfix
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thanks for this PR, could you please add related tests for both WebMvc and WebFlux that show a failure with current implementation and would be green with your fix in the 2 |
Co-authored-by: hojongs <hojong.jjh@gmail.com> Co-authored-by: bjh970913 <bjh970913@gmail.com>
Co-authored-by: hojongs <hojong.jjh@gmail.com> Co-authored-by: bjh970913 <bjh970913@gmail.com>
b916a57
to
b7e6d23
Compare
@sdeleuze Do you have any updates or plans for this ...? |
Yes it is planned for inclusion in Spring Framework 5.3.7 as mentioned in #26838. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolve #26838
This PR fixes following bug.
spring-framework/spring-webmvc/src/main/kotlin/org/springframework/web/servlet/function/RouterFunctionDsl.kt
Lines 650 to 655 in 5b1ab31
spring-framework/spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/CoRouterFunctionDsl.kt
Lines 531 to 539 in 5b1ab31
filterFunction
takesserverRequest
and functionhandler
as parameters. (I just named them.)handler
also takesserverRequest
as parameter.handler
.handler
s that these DSLs defined are now using mistakenlyfilterFunction
'sserverRequest
, not their ownserverRequest
parameters, which makes their own parameters meaningless.This bug only exists in Kotlin DSL.
You can see java codes have no problem as follows.
spring-framework/spring-webmvc/src/main/java/org/springframework/web/servlet/function/HandlerFilterFunction.java
Line 46 in 01e50fb
spring-framework/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/HandlerFilterFunction.java
Line 48 in 01e50fb
In java you can override filter something like
but in Kotlin DSL, even if you write
handlerFunction will use original serverRequest, not the newServerRequest