From a56dc48577343ff2f42ccb3b810e39ae111669be Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Mon, 22 May 2023 22:09:19 -0700 Subject: [PATCH] Add periods to response messages for consistency --- functions/api.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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' } }); } } -- 2.47.3