-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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 Kotlin filter parameter bug in Router DSLs #26838
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Comments
ShindongLee
changed the title
Router handlerFunction in filter should use its parameter (request)
Router handlerFunction in filter should use its own parameter (serverRequest)
Apr 21, 2021
spring-projects-issues
added
the
status: waiting-for-triage
An issue we've not yet triaged or decided on
label
Apr 21, 2021
ShindongLee
changed the title
Router handlerFunction in filter should use its own parameter (serverRequest)
[KotlinDSL][Bug] handler (second parameter of filterFunction) in [Co]RouterFunctionDsl is using wrong parameter (not its own)
Apr 24, 2021
ShindongLee
changed the title
[KotlinDSL][Bug] handler (second parameter of filterFunction) in [Co]RouterFunctionDsl is using wrong parameter (not its own)
[KotlinDSL][Bug] handler (second parameter of filterFunction) that [Co]RouterFunctionDsl defines is using wrong parameter (not its own)
Apr 24, 2021
sdeleuze
added
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: bug
A general bug
and removed
status: waiting-for-triage
An issue we've not yet triaged or decided on
labels
Apr 28, 2021
Good catch, to be backported on |
snicoll
changed the title
[KotlinDSL][Bug] handler (second parameter of filterFunction) that [Co]RouterFunctionDsl defines is using wrong parameter (not its own)
HandlerFunction (second parameter of filterFunction) that [Co]RouterFunctionDsl defines is using wrong parameter (not its own)
Apr 28, 2021
@sdeleuze I added tests. Thank you ! |
sdeleuze
changed the title
HandlerFunction (second parameter of filterFunction) that [Co]RouterFunctionDsl defines is using wrong parameter (not its own)
Fix Kotlin filter parameter bug in Router DSLs
May 10, 2021
spring-projects-issues
added
status: backported
An issue that has been backported to maintenance branches
and removed
for: backport-to-5.2.x
labels
May 10, 2021
lxbzmy
pushed a commit
to lxbzmy/spring-framework
that referenced
this issue
Mar 26, 2022
Co-authored-by: hojongs <[email protected]> Co-authored-by: bjh970913 <[email protected]> Closes spring-projectsgh-26838
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general 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 name it second parameter offilterFunction
ashandler
.)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
The text was updated successfully, but these errors were encountered: