From 824896b6bc88e61b28b636e2bc040f1cf5d6ad83 Mon Sep 17 00:00:00 2001 From: Lamberto Basti Date: Thu, 23 May 2024 16:39:04 +0200 Subject: [PATCH] 241 - Add UserAgent to Ktor client and remove GITHUB_REF from run settings (#177) The commit introduces a new UserAgent to the Ktor client within the PackageSearchApplicationCachesService.kt for the IntelliJApplication. The UserAgent is set using fullApplicationName coming from the service ApplicationInfo. On a different note, an unused environment variable GITHUB_REF has been removed from the Plugin.run.xml configuration file, for cleanup purposes. --- .run/[KMP] Package Search Plugin.run.xml | 1 - .../plugin/services/PackageSearchApplicationCachesService.kt | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.run/[KMP] Package Search Plugin.run.xml b/.run/[KMP] Package Search Plugin.run.xml index d31f4c3e..246431b0 100644 --- a/.run/[KMP] Package Search Plugin.run.xml +++ b/.run/[KMP] Package Search Plugin.run.xml @@ -4,7 +4,6 @@ diff --git a/plugin/src/main/kotlin/com/jetbrains/packagesearch/plugin/services/PackageSearchApplicationCachesService.kt b/plugin/src/main/kotlin/com/jetbrains/packagesearch/plugin/services/PackageSearchApplicationCachesService.kt index ef7fe1d3..709a19d5 100644 --- a/plugin/src/main/kotlin/com/jetbrains/packagesearch/plugin/services/PackageSearchApplicationCachesService.kt +++ b/plugin/src/main/kotlin/com/jetbrains/packagesearch/plugin/services/PackageSearchApplicationCachesService.kt @@ -24,6 +24,7 @@ import com.jetbrains.packagesearch.plugin.utils.PackageSearchLogger import com.jetbrains.packagesearch.plugin.utils.PackageSearchProjectService import io.ktor.client.engine.java.Java import io.ktor.client.plugins.DefaultRequest +import io.ktor.client.plugins.UserAgent import io.ktor.client.plugins.logging.LogLevel import io.ktor.client.plugins.logging.Logging import io.ktor.client.request.headers @@ -98,6 +99,9 @@ class PackageSearchApplicationCachesService(private val coroutineScope: Coroutin append("JB-IDE-Version", IntelliJApplication.service().strictVersion) } } + install(UserAgent) { + agent = IntelliJApplication.service().fullApplicationName + } } )