Skip to content

Commit

Permalink
Return request information from /api/hello
Browse files Browse the repository at this point in the history
  • Loading branch information
paulshryock committed Jul 13, 2024
1 parent 14835c8 commit 356bf02
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/routes/api/hello.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import type { Context } from '@netlify/functions'

/**
* Says hello.
* Returns request information.
*
* @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(
JSON.stringify({
body: request.body,
headers: request.headers,
method: request.method,
request,
}),
{ status: 200, statusText: 'OK' },
)
}

0 comments on commit 356bf02

Please sign in to comment.