return 304 if a tile doesn't exist (nicer than having the browser spammed with errors)

This commit is contained in:
Adam 2022-07-17 23:55:58 +02:00
parent 085776d42b
commit 6fa826baa2

View file

@ -61,20 +61,9 @@ private suspend fun PipelineContext<Unit, ApplicationCall>.handleTileRequest(
)
}
} else {
call.respond(HttpStatusCode.NotFound)
// // It's not a client error to request this tile, it just doesn't exist (yet). So return 304?
// call.response.cacheControl(CacheControl.NoStore(null))
//
// HeadersBuilder(size = 2).apply {
// EntityTagVersion(System.currentTimeMillis().hashCode().toString())
// .appendHeadersTo(this)
// LastModifiedVersion(System.currentTimeMillis())
// .appendHeadersTo(this)
// }.build().flattenForEach { name, value ->
// call.response.header(name, value)
// }
//
// call.respond(HttpStatusCode.NotModified)
// It's not a client or server error to request a non-existent tile, it just doesn't exist
// (yet). So return 304.
call.respond(HttpStatusCode.NotModified)
}
}