Add User-Agent to Modrinth request

This commit is contained in:
Ecorous 2024-06-07 17:06:12 +01:00
parent a00d6b2be2
commit a3266f36ff
Signed by: Ecorous
SSH key fingerprint: SHA256:ni7WK6Ud51dVmDv8DctoqLEr3XXhAI51s6IFMYvJKDM

View file

@ -133,7 +133,11 @@ fun Application.configureRouting() {
"message" to "Version not found."
)
// fetch https://api.modrinth.com/v2/version/{version} to get json
val client = HttpClient()
val client = HttpClient {
headers {
append("User-Agent", "FrogMCMeta (https://git.frogmc.dev/frogmc/meta)/1.0")
}
}
val response = client.get("https://api.modrinth.com/v2/version/${versionObj.modrinthVersion}")
val mrVersionString = response.body<String>()
val json = Json { ignoreUnknownKeys = true }