Skip to content

Commit

Permalink
Revert "Return context and request objects from /api/hello"
Browse files Browse the repository at this point in the history
This reverts commit 14835c8.
  • Loading branch information
paulshryock committed Jul 13, 2024
1 parent 14835c8 commit c7a0a96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/routes/api/hello.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' })
}
5 changes: 5 additions & 0 deletions tests/unit/routes/api/hello.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!',
))
})

0 comments on commit c7a0a96

Please sign in to comment.