Skip to content

Commit 5d782cf

Browse files
committed
Disable caching
1 parent e412419 commit 5d782cf

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/main/kotlin/ru/ardyc/client/DefaultGithubClient.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class DefaultGithubClient : GithubClient {
3030
override fun resolveRepository(fullRepositoryName: String): Repository? {
3131
try {
3232
return runBlocking {
33-
val response: GithubResponse = client.get("https://api.github.com/repos/$fullRepositoryName").body()
33+
val response: GithubResponse = client
34+
.get("https://api.github.com/repos/$fullRepositoryName")
35+
.body()
3436
val repository = Repository(
3537
response.fullName,
3638
response.description,

src/main/kotlin/ru/ardyc/controller/BadgeController.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fun Route.configureBadgeEndpoints() {
1313
val badgeService: BadgeGenerationService by inject<BadgeGenerationService>()
1414

1515
get("/") {
16+
call.response.header("Connection", "keep-alive")
1617
call.respondTextWriter(contentType = ContentType.parse("image/svg+xml")) {
1718
val params = call.request.queryParameters
1819
append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n")

src/main/kotlin/ru/ardyc/plugins/Caching.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@ fun Application.configureCaching() {
1010
options { _, content ->
1111
when (content.contentType?.withoutParameters()) {
1212
ContentType.Image.SVG -> CachingOptions(
13-
CacheControl.NoStore(visibility = CacheControl.Visibility.Public)
13+
object : CacheControl(visibility = Visibility.Public) {
14+
override fun toString(): String {
15+
return "no-cache,no-store,public,max-age=0,must-revalidate"
16+
}
17+
}
1418
)
19+
1520
else -> null
1621
}
1722
}

0 commit comments

Comments
 (0)