From: Ardis Lu Date: Tue, 23 May 2023 05:09:19 +0000 (-0700) Subject: Add periods to response messages for consistency X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=a56dc48577343ff2f42ccb3b810e39ae111669be;p=alu.bz Add periods to response messages for consistency --- diff --git a/functions/api.js b/functions/api.js index 087dd5a..2eab950 100644 --- a/functions/api.js +++ b/functions/api.js @@ -52,11 +52,11 @@ export async function onRequestPost({ request, env }) { } // Invalid short URLs else if (!/^[0-9a-zA-Z-_]*$/g.test(shortUrl) || shortUrl === 'api') { - return new Response('Invalid short URL', { status: 400, headers: { 'Content-Type': 'text/plain; charset=UTF-8' } }); + return new Response('Invalid short URL.', { status: 400, headers: { 'Content-Type': 'text/plain; charset=UTF-8' } }); } // User-provided duplicates else if (await env.links.get(shortUrl) !== null) { - return new Response('This short URL is already taken', { status: 400, headers: { 'Content-Type': 'text/plain; charset=UTF-8' } }); + return new Response('This short URL is already taken.', { status: 400, headers: { 'Content-Type': 'text/plain; charset=UTF-8' } }); } // Invalid full URLs @@ -64,7 +64,7 @@ export async function onRequestPost({ request, env }) { new URL(fullUrl); } catch (error) { - return new Response('Invalid full URL', { status: 400, headers: { 'Content-Type': 'text/plain; charset=UTF-8' } }); + return new Response('Invalid full URL.', { status: 400, headers: { 'Content-Type': 'text/plain; charset=UTF-8' } }); } if (!isRandomlyGenerated) { @@ -75,7 +75,7 @@ export async function onRequestPost({ request, env }) { const signingAddress = verifyMessage(message, signature); const nftCount = await getNftCount(signingAddress); if (!(nftCount > 0)) { - return new Response('Invalid signature', { status: 403, headers: { 'Content-Type': 'text/plain; charset=UTF-8' } }); + return new Response('Invalid signature.', { status: 403, headers: { 'Content-Type': 'text/plain; charset=UTF-8' } }); } }