Skip to content

Commit

Permalink
Fix url prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
rjaros committed Dec 3, 2024
1 parent 0adde4f commit f21ef56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,39 +56,39 @@ open class KVController {

@Get("/{+path}")
suspend fun get(@PathVariable path: String?, request: HttpRequest<*>): HttpResponse<String> =
handle(HttpMethod.GET, "/rpc/$path", request)
handle(HttpMethod.GET, "/kv/$path", request)

@Suppress("UNUSED_PARAMETER")
@Post("/{+path}")
suspend fun post(
@PathVariable path: String?,
request: HttpRequest<*>,
@Body body: JsonRpcRequest
): HttpResponse<String> = handle(HttpMethod.POST, "/rpc/$path", request)
): HttpResponse<String> = handle(HttpMethod.POST, "/kv/$path", request)

@Suppress("UNUSED_PARAMETER")
@Put("/{+path}")
suspend fun put(
@PathVariable path: String?,
request: HttpRequest<*>,
@Body body: JsonRpcRequest
): HttpResponse<String> = handle(HttpMethod.PUT, "/rpc/$path", request)
): HttpResponse<String> = handle(HttpMethod.PUT, "/kv/$path", request)

@Suppress("UNUSED_PARAMETER")
@Delete("/{+path}")
suspend fun delete(
@PathVariable path: String?,
request: HttpRequest<*>,
@Body body: JsonRpcRequest
): HttpResponse<String> = handle(HttpMethod.DELETE, "/rpc/$path", request)
): HttpResponse<String> = handle(HttpMethod.DELETE, "/kv/$path", request)

@Suppress("UNUSED_PARAMETER")
@Options("/{+path}")
suspend fun options(
@PathVariable path: String?,
request: HttpRequest<*>,
@Body body: JsonRpcRequest
): HttpResponse<String> = handle(HttpMethod.OPTIONS, "/rpc/$path", request)
): HttpResponse<String> = handle(HttpMethod.OPTIONS, "/kv/$path", request)

private suspend fun handle(method: HttpMethod, path: String, request: HttpRequest<*>): HttpResponse<String> {
val handler = kvManagers.services.asSequence().mapNotNull {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ open class KVSseController {
@ExecuteOn(TaskExecutors.IO)
@Get("/{+path}", produces = [MediaType.TEXT_EVENT_STREAM])
fun getSse(@PathVariable path: String?, request: HttpRequest<*>): Publisher<Event<String>> =
handleSse("/rpcsse/$path", request)
handleSse("/kvsse/$path", request)

private fun handleSse(path: String, request: HttpRequest<*>): Publisher<Event<String>> {
val handler = kvManagers.services.asSequence().mapNotNull {
Expand Down

0 comments on commit f21ef56

Please sign in to comment.