From 3a89a0942af408fc0966ad615665560b8e35b903 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Tue, 16 Jan 2024 14:06:35 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20ActivityPub=E3=81=AE=E9=80=9A=E4=BF=A1?= =?UTF-8?q?=E3=81=AB=E4=BD=BF=E3=81=86HTTP=E3=82=AF=E3=83=A9=E3=82=A4?= =?UTF-8?q?=E3=82=A2=E3=83=B3=E3=83=88=E3=81=AEUserAgent=E3=82=92=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hideout/application/config/HttpClientConfig.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/application/config/HttpClientConfig.kt b/src/main/kotlin/dev/usbharu/hideout/application/config/HttpClientConfig.kt index 6000f0a3..9eb4eea9 100644 --- a/src/main/kotlin/dev/usbharu/hideout/application/config/HttpClientConfig.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/config/HttpClientConfig.kt @@ -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})" + } } }