Skip to content

Commit 73f281e

Browse files
committed
chore: misc changes
1 parent 960245c commit 73f281e

File tree

2 files changed

+70
-67
lines changed

2 files changed

+70
-67
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,14 @@ $ ./gradlew :backend:jvm:run
218218
### Misc
219219

220220
```bash
221-
# KMP hierarchy, Dependencies
222-
$ ./gradlew :shared:printHierarchy
221+
# Dependency Insight
222+
$ ./gradlew dependencies
223+
$ ./gradlew :shared:dependencies --configuration testRuntimeClasspath
224+
$ ./gradlew -q :shared:dependencyInsight --dependency slf4j-api --configuration RuntimeClasspath
223225
$ ./gradlew :backend:jvm:listResolvedArtifacts
226+
227+
# KMP hierarchy and module graphs
228+
$ ./gradlew :shared:printHierarchy
224229
$ ./gradlew createModuleGraph
225230
$ ./gradlew generateChangelog
226231

@@ -233,7 +238,6 @@ $ ./gradlew :backend:jvm:run
233238
# Gradle Best Practices
234239
$ ./gradlew -p gradle/build-logic :bestPracticesBaseline
235240
$ ./gradlew checkBuildLogicBestPractices
236-
$ ./gradlew dependencies
237241

238242
# GitHub Actions lint
239243
$ actionlint

shared/src/commonMain/kotlin/dev/suresh/http/MediaApiClient.kt

Lines changed: 63 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -41,70 +41,69 @@ class MediaApiClient(val timeout: Timeout = Timeout.DEFAULT, val retry: Retry =
4141

4242
private val log = KotlinLogging.logger {}
4343

44-
private val client =
45-
HttpClient {
46-
install(Resources)
47-
install(ContentNegotiation) { json(dev.suresh.json) }
48-
49-
install(ContentEncoding) {
50-
deflate(1.0F)
51-
gzip(0.9F)
52-
}
53-
54-
install(HttpRequestRetry) {
55-
maxRetries = retry.attempts
56-
retryOnException(retryOnTimeout = true)
57-
retryOnServerErrors()
58-
constantDelay(millis = retry.maxDelay.inWholeMilliseconds)
59-
}
60-
61-
install(HttpTimeout) {
62-
connectTimeoutMillis = timeout.connection.inWholeMilliseconds
63-
requestTimeoutMillis = timeout.read.inWholeMilliseconds
64-
socketTimeoutMillis = timeout.write.inWholeMilliseconds
65-
}
66-
67-
install(HttpCookies)
68-
69-
install(Logging) {
70-
logger = Logger.DEFAULT
71-
level = LogLevel.INFO
72-
sanitizeHeader { header -> header == HttpHeaders.Authorization }
73-
}
74-
75-
engine { pipelining = true }
76-
77-
followRedirects = true
78-
79-
install(UserAgent) { agent = "Image API Client" }
80-
81-
install(DefaultRequest) {
82-
url("https://suresh.dev/")
83-
headers.appendIfNameAndValueAbsent(
84-
HttpHeaders.ContentType, ContentType.Application.Json.toString())
85-
}
86-
87-
// install(Auth) {
88-
// basic {
89-
// credentials {
90-
// sendWithoutRequest { true }
91-
// BasicAuthCredentials(username = "", password = "")
92-
// }
93-
// }
94-
// }
95-
//
96-
// expectSuccess = false
97-
//
98-
// HttpResponseValidator {
99-
// validateResponse {
100-
// when (it.status.value) {
101-
// in 300..399 -> throw RedirectResponseException(it, "Redirect error")
102-
// in 400..499 -> throw ClientRequestException(it, "Client error")
103-
// in 500..599 -> throw ServerResponseException(it, "Server error")
104-
// }
105-
// }
106-
// }
107-
}
44+
private val client = HttpClient {
45+
install(Resources)
46+
install(ContentNegotiation) { json(dev.suresh.json) }
47+
48+
install(ContentEncoding) {
49+
deflate(1.0F)
50+
gzip(0.9F)
51+
}
52+
53+
install(HttpRequestRetry) {
54+
maxRetries = retry.attempts
55+
retryOnException(retryOnTimeout = true)
56+
retryOnServerErrors()
57+
constantDelay(millis = retry.maxDelay.inWholeMilliseconds)
58+
}
59+
60+
install(HttpTimeout) {
61+
connectTimeoutMillis = timeout.connection.inWholeMilliseconds
62+
requestTimeoutMillis = timeout.read.inWholeMilliseconds
63+
socketTimeoutMillis = timeout.write.inWholeMilliseconds
64+
}
65+
66+
install(HttpCookies)
67+
68+
install(Logging) {
69+
logger = Logger.DEFAULT
70+
level = LogLevel.INFO
71+
sanitizeHeader { header -> header == HttpHeaders.Authorization }
72+
}
73+
74+
engine { pipelining = true }
75+
76+
followRedirects = true
77+
78+
install(UserAgent) { agent = "Image API Client" }
79+
80+
install(DefaultRequest) {
81+
url("https://suresh.dev/")
82+
headers.appendIfNameAndValueAbsent(
83+
HttpHeaders.ContentType, ContentType.Application.Json.toString())
84+
}
85+
86+
// install(Auth) {
87+
// basic {
88+
// credentials {
89+
// sendWithoutRequest { true }
90+
// BasicAuthCredentials(username = "", password = "")
91+
// }
92+
// }
93+
// }
94+
//
95+
// expectSuccess = false
96+
//
97+
// HttpResponseValidator {
98+
// validateResponse {
99+
// when (it.status.value) {
100+
// in 300..399 -> throw RedirectResponseException(it, "Redirect error")
101+
// in 400..499 -> throw ClientRequestException(it, "Client error")
102+
// in 500..599 -> throw ServerResponseException(it, "Server error")
103+
// }
104+
// }
105+
// }
106+
}
108107

109108
suspend fun images() = client.get(ImgRes()).body<List<Image>>()
110109

0 commit comments

Comments
 (0)