diff --git a/main.js b/main.js index 3917849..7f89c79 100644 --- a/main.js +++ b/main.js @@ -30,12 +30,13 @@ async function handleRequest(request, env, ctx) { } case "/info": { if (!util.validateBasicAuth(request)) { - return new Response('I\'m a teapot', { - status: 418, - headers: { - 'content-type': 'text/plain', - } - }) + return new Response('Unauthorized', { + status: 401, + headers: { + 'content-type': 'text/plain', + 'WWW-Authenticate': 'Basic', + } + }) } return handler.info(searchParams) @@ -45,10 +46,11 @@ async function handleRequest(request, env, ctx) { if (pathParts[1]) { if (!util.validateBasicAuth(request)) { - return new Response('I\'m a teapot', { - status: 418, + return new Response('Unauthorized', { + status: 401, headers: { 'content-type': 'text/plain', + 'WWW-Authenticate': 'Basic', } }) } @@ -564,4 +566,4 @@ class Util { } } -const util = new Util() \ No newline at end of file +const util = new Util()