-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return request information from /api/hello
- Loading branch information
1 parent
14835c8
commit 356bf02
Showing
1 changed file
with
14 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' }, | ||
) | ||
} |