From bf79d023b801ac4f508a8c9a2030cd97f5089c38 Mon Sep 17 00:00:00 2001 From: Patrick Toal Date: Mon, 17 Jun 2024 17:15:47 -0400 Subject: [PATCH] Debugging --- functions/userinfo/src/main.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/functions/userinfo/src/main.ts b/functions/userinfo/src/main.ts index 0ac7a5e..66d72ae 100644 --- a/functions/userinfo/src/main.ts +++ b/functions/userinfo/src/main.ts @@ -10,7 +10,20 @@ type Context = { error: (msg: any) => void; }; -export default async function ({req, res, error}: Context){ +export default async function ({req, res, log,error}: Context){ + + // Output some info + log(req.bodyRaw); // Raw request body, contains request data + log(JSON.stringify(req.body)); // Object from parsed JSON request body, otherwise string + log(JSON.stringify(req.headers)); // String key-value pairs of all request headers, keys are lowercase + log(req.scheme); // Value of the x-forwarded-proto header, usually http or https + log(req.method); // Request method, such as GET, POST, PUT, DELETE, PATCH, etc. + log(req.url); // Full URL, for example: http://awesome.appwrite.io:8000/v1/hooks?limit=12&offset=50 + log(req.host); // Hostname from the host header, such as awesome.appwrite.io + log(req.port); // Port from the host header, for example 8000 + log(req.path); // Path part of URL, for example /v1/hooks + log(req.queryString); // Raw query params string. For example "limit=12&offset=50" + log(JSON.stringify(req.query)); // Parsed query params. For example, req.query.limit const PROJECT_ID = Deno.env.get("APPWRITE_FUNCTION_PROJECT_ID") const API_KEY = Deno.env.get("APPWRITE_API_KEY")