Skip to content

Commit

Permalink
feat(Http): set proper User-Agent
Browse files Browse the repository at this point in the history
  • Loading branch information
rushiiMachine committed Aug 2, 2024
1 parent 304b634 commit 9759fbd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/src/main/kotlin/com/aliucord/manager/di/Http.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package com.aliucord.manager.di

import com.aliucord.manager.BuildConfig
import io.ktor.client.HttpClient
import io.ktor.client.engine.okhttp.OkHttp
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
import io.ktor.client.plugins.defaultRequest
import io.ktor.client.request.header
import io.ktor.http.HttpHeaders
import io.ktor.serialization.kotlinx.json.json
import kotlinx.serialization.json.Json
import okhttp3.Dns
Expand All @@ -18,6 +22,9 @@ fun Scope.provideJson() = Json {
fun Scope.provideHttpClient() = HttpClient(OkHttp) {
val json: Json = get()

defaultRequest {
header(HttpHeaders.UserAgent, "Aliucord Manager/${BuildConfig.VERSION_NAME}")
}
engine {
config {
dns(object : Dns {
Expand Down

0 comments on commit 9759fbd

Please sign in to comment.