mirror of https://github.com/usbharu/Hideout.git
Merge pull request #239 from usbharu/feature/user-agent
feat: ActivityPubの通信に使うHTTPクライアントのUserAgentを設定
This commit is contained in:
commit
afbddad21b
|
@ -316,3 +316,7 @@ koverReport {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
springBoot {
|
||||
buildInfo()
|
||||
}
|
||||
|
|
|
@ -2,15 +2,18 @@ package dev.usbharu.hideout.application.config
|
|||
|
||||
import io.ktor.client.*
|
||||
import io.ktor.client.engine.cio.*
|
||||
import io.ktor.client.plugins.*
|
||||
import io.ktor.client.plugins.cache.*
|
||||
import io.ktor.client.plugins.logging.*
|
||||
import org.springframework.boot.info.BuildProperties
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
|
||||
@Configuration
|
||||
class HttpClientConfig {
|
||||
@Bean
|
||||
fun httpClient(): HttpClient = HttpClient(CIO).config {
|
||||
fun httpClient(buildProperties: BuildProperties, applicationConfig: ApplicationConfig): HttpClient =
|
||||
HttpClient(CIO).config {
|
||||
install(Logging) {
|
||||
logger = Logger.DEFAULT
|
||||
level = LogLevel.ALL
|
||||
|
@ -18,5 +21,8 @@ class HttpClientConfig {
|
|||
install(HttpCache) {
|
||||
}
|
||||
expectSuccess = true
|
||||
}
|
||||
install(UserAgent) {
|
||||
agent = "Hideout/${buildProperties.version} (${applicationConfig.url})"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue