-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed argument resolver & finer grained serialization (#298)
Co-authored-by: nsimonides <[email protected]>
- Loading branch information
Showing
5 changed files
with
81 additions
and
24 deletions.
There are no files selected for viewing
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
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
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
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
24 changes: 24 additions & 0 deletions
24
...tion/spring/src/jvmMain/kotlin/community/flock/wirespec/integration/spring/shared/Util.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package community.flock.wirespec.integration.spring.shared | ||
|
||
import jakarta.servlet.http.HttpServletRequest | ||
|
||
/** | ||
* Depending on how the controller is mapped: | ||
* | ||
* @RequestMapping("/pet/{id}") | ||
* // or | ||
* @GetMapping("/pet/{id}") | ||
* | ||
* The path ends up in either the pathInfo or servletPath | ||
*/ | ||
fun HttpServletRequest.extractPath() = (if (pathInfo != null) pathInfo else servletPath) | ||
.split("/") | ||
.filter { it.isNotEmpty() } | ||
|
||
fun HttpServletRequest.extractQueries() = queryString | ||
?.split("&") | ||
?.associate { | ||
val (key, value) = it.split("=") | ||
key to value | ||
} | ||
.orEmpty() |