Add User-Agent to Modrinth request
This commit is contained in:
parent
a00d6b2be2
commit
a3266f36ff
|
@ -133,7 +133,11 @@ fun Application.configureRouting() {
|
||||||
"message" to "Version not found."
|
"message" to "Version not found."
|
||||||
)
|
)
|
||||||
// fetch https://api.modrinth.com/v2/version/{version} to get json
|
// 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 response = client.get("https://api.modrinth.com/v2/version/${versionObj.modrinthVersion}")
|
||||||
val mrVersionString = response.body<String>()
|
val mrVersionString = response.body<String>()
|
||||||
val json = Json { ignoreUnknownKeys = true }
|
val json = Json { ignoreUnknownKeys = true }
|
||||||
|
|
Loading…
Reference in a new issue