Set Content-Type header for HTML responses in IndexHandler

Added `Content-Type: text/html` header in `IndexHandler` to ensure correct content type for HTML responses.
This commit is contained in:
2025-08-18 19:49:54 +02:00
parent 9894f9d511
commit cdb88c7c5f

View File

@@ -5,12 +5,14 @@ import io.undertow.server.HttpServerExchange
import io.undertow.server.handlers.PathHandler
import io.undertow.server.handlers.resource.PathResourceManager
import io.undertow.server.handlers.resource.ResourceHandler
import io.undertow.util.Headers
import nl.astraeus.tmpl.itemUrl
import java.nio.file.Paths
import kotlin.text.startsWith
object IndexHandler : HttpHandler {
override fun handleRequest(exchange: HttpServerExchange) {
exchange.responseHeaders.put(Headers.CONTENT_TYPE, "text/html")
if (exchange.requestPath.startsWith("/$itemUrl/")) {
exchange.responseSender.send(generateIndex(null))
} else {