-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix/integration test dependency (#957)
* Specify fasterxml jackson core version for Google cloud bom libraries * Include rationale * Adjust comment format
- Loading branch information
Showing
5 changed files
with
40 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
cloud-run/src/commonMain/kotlin/io/ashdavies/cloud/JsonProperty.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
cloud-run/src/commonMain/kotlin/io/ashdavies/cloud/Validator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.ashdavies.cloud | ||
|
||
import io.ktor.client.HttpClientConfig | ||
import io.ktor.client.call.body | ||
import io.ktor.client.plugins.ClientRequestException | ||
import io.ktor.client.plugins.HttpCallValidator | ||
import kotlinx.serialization.Serializable | ||
|
||
internal fun HttpClientConfig<*>.installCallValidator() { | ||
install(HttpCallValidator) { | ||
handleResponseExceptionWithRequest { exception, _ -> | ||
if (exception is ClientRequestException) { | ||
throw exception.response.body<GoogleApisException>() | ||
} | ||
} | ||
} | ||
|
||
expectSuccess = true | ||
} | ||
|
||
@Serializable | ||
internal data class GoogleApisException(val error: Error) : Exception(error.message) { | ||
|
||
@Serializable | ||
data class Error( | ||
val code: Int, | ||
val message: String, | ||
val status: String, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters