Skip to content

Instantly share code, notes, and snippets.

@tdcolvin
Created May 8, 2025 16:04
Show Gist options
  • Select an option

  • Save tdcolvin/5843efb37de3610da75fc1477f7106c3 to your computer and use it in GitHub Desktop.

Select an option

Save tdcolvin/5843efb37de3610da75fc1477f7106c3 to your computer and use it in GitHub Desktop.
suspend fun sendRegistrationResponse(
registrationResponseJson: String,
) = withContext(Dispatchers.IO) {
val url = HttpUrl.Builder()
.scheme("https")
.host("auth.tomcolvin.co.uk")
.addPathSegment("verify-registration")
.build()
val request = Request.Builder()
.url(url)
.post(registrationResponseJson.toRequestBody("application/json".toMediaType()))
.build()
val response = okHttpClient.newCall(request).execute()
if (response.code != 200) {
throw Exception("Registration failed: ${response.body?.string()}")
}
response.body?.string() ?: "{}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment