Browse Source

Refine ServerRequest.queryParamOrNull implementation

Closes gh-31264
pull/31282/head
김희망 1 year ago committed by Sébastien Deleuze
parent
commit
6caef9bb3c
  1. 10
      spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensions.kt

10
spring-webflux/src/main/kotlin/org/springframework/web/reactive/function/server/ServerRequestExtensions.kt

@ -173,15 +173,7 @@ fun ServerRequest.attributeOrNull(name: String): Any? = attributes()[name] @@ -173,15 +173,7 @@ fun ServerRequest.attributeOrNull(name: String): Any? = attributes()[name]
*/
fun ServerRequest.queryParamOrNull(name: String): String? {
val queryParamValues = queryParams()[name]
return if (CollectionUtils.isEmpty(queryParamValues)) {
null
} else {
var value: String? = queryParamValues!![0]
if (value == null) {
value = ""
}
value
}
return if (queryParamValues.isNullOrEmpty()) null else queryParamValues[0] ?: ""
}
/**

Loading…
Cancel
Save