Skip to content

Commit e579260

Browse files
committed
Include headers to anti-cache in random endpoint
1 parent 05227ec commit e579260

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/kotlin/com/jeluchu/features/anime/services/AnimeService.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ class AnimeService(
125125

126126
directoryCollection.aggregate(aggregates).firstOrNull()?.let { anime ->
127127
val info = documentToMoreInfoEntity(anime)
128+
129+
call.response.headers.append("Cache-Control", "no-cache, no-store, must-revalidate, private")
130+
call.response.headers.append("Pragma", "no-cache")
131+
call.response.headers.append("Expires", "0")
132+
call.response.headers.append("Vary", "*")
133+
128134
call.respond(HttpStatusCode.OK, Json.encodeToString(info))
129135
} ?: call.respond(HttpStatusCode.NotFound, ErrorResponse(ErrorMessages.AnimeNotFound.message))
130136
} catch (ex: Exception) {

0 commit comments

Comments
 (0)