mirror of https://github.com/usbharu/Hideout.git
feat: レスポンスをutilで作成するように
This commit is contained in:
parent
88fd245d3f
commit
bdb538afd9
|
@ -2,6 +2,7 @@ package dev.usbharu.hideout.routing.activitypub
|
||||||
|
|
||||||
import dev.usbharu.hideout.config.Config
|
import dev.usbharu.hideout.config.Config
|
||||||
import dev.usbharu.hideout.exception.ParameterNotExistException
|
import dev.usbharu.hideout.exception.ParameterNotExistException
|
||||||
|
import dev.usbharu.hideout.plugins.respondAp
|
||||||
import dev.usbharu.hideout.service.activitypub.ActivityPubUserService
|
import dev.usbharu.hideout.service.activitypub.ActivityPubUserService
|
||||||
import dev.usbharu.hideout.util.HttpUtil.Activity
|
import dev.usbharu.hideout.util.HttpUtil.Activity
|
||||||
import dev.usbharu.hideout.util.HttpUtil.JsonLd
|
import dev.usbharu.hideout.util.HttpUtil.JsonLd
|
||||||
|
@ -17,8 +18,10 @@ fun Routing.usersAP(activityPubUserService: ActivityPubUserService) {
|
||||||
val name =
|
val name =
|
||||||
call.parameters["name"] ?: throw ParameterNotExistException("Parameter(name='name') does not exist.")
|
call.parameters["name"] ?: throw ParameterNotExistException("Parameter(name='name') does not exist.")
|
||||||
val person = activityPubUserService.getPersonByName(name)
|
val person = activityPubUserService.getPersonByName(name)
|
||||||
call.response.header("Content-Type", ContentType.Application.Activity.toString())
|
return@handle call.respondAp(
|
||||||
return@handle call.respond(HttpStatusCode.OK, Config.configData.objectMapper.writeValueAsString(person))
|
person,
|
||||||
|
HttpStatusCode.OK
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue