fix: correct content-type for HTML pages and allow password-less redis (#418)

* fix: correct content-type for HTML pages and allow password-less redis

Set Content-Type to 'text/html' instead of 'text' for index and
error page responses, since both return HTML content.

Also change redis username/password fallback from empty string to
undefined so that the driver skips AUTH when no credentials are
configured. An empty string causes AUTH to be sent which fails on
servers with no password set.

Fixes #387, fixes #388

* fix: revert unintended formatting change to pass deno fmt check

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ömer 2026-03-04 08:51:25 +03:00 • committed by GitHub
parent 192693fe27
commit 611e5bf0b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -92,7 +92,7 @@ async function app(req: Request): Promise<Response> {
{ {
status: error.status, status: error.status,
headers: new Headers({ headers: new Headers({
"Content-Type": "text", "Content-Type": "text/html",
"Cache-Control": cacheControlHeader, "Cache-Control": cacheControlHeader,
}), }),
}, },
@ -138,7 +138,7 @@ async function app(req: Request): Promise<Response> {
{ {
status: userResponseInfo.code, status: userResponseInfo.code,
headers: new Headers({ headers: new Headers({
"Content-Type": "text", "Content-Type": "text/html",
"Cache-Control": cacheControlHeader, "Cache-Control": cacheControlHeader,
}), }),
}, },

View file

@ -23,8 +23,8 @@ class CacheProvider {
this.client = await connect({ this.client = await connect({
hostname: Deno.env.get("REDIS_HOST") || "", hostname: Deno.env.get("REDIS_HOST") || "",
port: Number(Deno.env.get("REDIS_PORT")) || 6379, port: Number(Deno.env.get("REDIS_PORT")) || 6379,
username: Deno.env.get("REDIS_USERNAME") || "", username: Deno.env.get("REDIS_USERNAME") || undefined,
password: Deno.env.get("REDIS_PASSWORD") || "", password: Deno.env.get("REDIS_PASSWORD") || undefined,
}); });
} }