diff --git a/.eslintignore b/.eslintignore index c6fd7e2..9164e44 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,4 +3,5 @@ .vscode dist node_modules -worker \ No newline at end of file +test.js +worker diff --git a/scripts/test.js b/scripts/test.js index 36ecbe7..75f7cbc 100644 --- a/scripts/test.js +++ b/scripts/test.js @@ -12,7 +12,7 @@ export const options = { let shortenLink -const BASE_URL = 'https://atomic-url-staging.jerrynsh.workers.dev/' +const BASE_URL = __ENV.TEST_URL const DUMMY_ORIGINAL_URL = 'https://jerrynsh.com/i-built-my-own-tiny-url/' export default function () { diff --git a/src/handlers/createShortUrl.js b/src/handlers/createShortUrl.js index b526927..6dfc835 100644 --- a/src/handlers/createShortUrl.js +++ b/src/handlers/createShortUrl.js @@ -54,6 +54,6 @@ export const createShortUrl = async (request, event) => { return response } catch (error) { console.error(error, error.stack) - return new Response('Unexpected Error', { status: 500 }) + return new Response('Internal Server Error', { status: 500 }) } } diff --git a/src/handlers/redirectShortUrl.js b/src/handlers/redirectShortUrl.js index 0d5d74d..cab2102 100644 --- a/src/handlers/redirectShortUrl.js +++ b/src/handlers/redirectShortUrl.js @@ -16,5 +16,5 @@ export const redirectShortUrl = async ({ params }) => { if (originalUrl) { return Response.redirect(originalUrl, 301) } - return new Response(NOT_FOUND_PAGE, { headers: { 'content-type': 'text/html;charset=UTF-8' } }) + return new Response(NOT_FOUND_PAGE, { headers: { 'Content-Type': 'text/html;charset=UTF-8' }, status: 404 }) } diff --git a/src/index.html b/src/index.html index 2dba6da..939dc38 100644 --- a/src/index.html +++ b/src/index.html @@ -14,10 +14,25 @@ +