From c7a0a96af6f6bc8af6dd2f1cb881784476d5740a Mon Sep 17 00:00:00 2001 From: Paul Shryock Date: Sat, 13 Jul 2024 11:17:23 -0400 Subject: [PATCH] Revert "Return context and request objects from /api/hello" This reverts commit 14835c88fa213d60c527066e60885669c143df88. --- src/routes/api/hello.ts | 13 +++++-------- tests/unit/routes/api/hello.test.ts | 5 +++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/routes/api/hello.ts b/src/routes/api/hello.ts index 0af227c..1f346be 100644 --- a/src/routes/api/hello.ts +++ b/src/routes/api/hello.ts @@ -3,14 +3,11 @@ import type { Context } from '@netlify/functions' /** * Says hello. * - * @param {Request} request HTTP request. - * @param {Context} context Netlify function context. - * @return {Response} HTTP response. + * @param {Request} _request HTTP request. + * @param {Context} _context Netlify function context. + * @return {Response} HTTP response. * @since unreleased */ -export default function hello(request: Request, context: Context): Response { - return new Response(JSON.stringify({ context, request }), { - status: 200, - statusText: 'OK', - }) +export default function hello(_request: Request, _context: Context): Response { + return new Response('Hello, world!', { status: 200, statusText: 'OK' }) } diff --git a/tests/unit/routes/api/hello.test.ts b/tests/unit/routes/api/hello.test.ts index 7a3bb9f..0d92c17 100644 --- a/tests/unit/routes/api/hello.test.ts +++ b/tests/unit/routes/api/hello.test.ts @@ -8,4 +8,9 @@ describe('GET /api/hello', () => { it('should return a 200 status code', () => expect(hello({} as Request, {} as Context).status).toBe(200)) + + it('should return response text of "Hello, world!"', async () => + expect(await hello({} as Request, {} as Context).text()).toBe( + 'Hello, world!', + )) })