From f4b856df15d584b003138a9a691f6d5c97991e57 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 8 Jul 2023 13:33:34 +0000 Subject: [PATCH] Expose parsed query args to request handlers. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4341 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- core/core.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/core.js b/core/core.js index 9129d374..8fc5f630 100644 --- a/core/core.js +++ b/core/core.js @@ -604,7 +604,7 @@ async function getBlobOrContent(id) { } let g_handler_index = 0; -async function useAppHandler(response, handler_blob_id, path) { +async function useAppHandler(response, handler_blob_id, path, query) { let do_resolve; let promise = new Promise(async function(resolve, reject) { do_resolve = resolve; @@ -617,6 +617,7 @@ async function useAppHandler(response, handler_blob_id, path) { imports: { request: { path: path, + query: query, }, respond: do_resolve, }, @@ -792,7 +793,7 @@ async function blobHandler(request, response, blobId, uri) { if (!id && app_object.files['handler.js']) { let answer; try { - answer = await useAppHandler(response, app_id, uri.substring(1)); + answer = await useAppHandler(response, app_id, uri.substring(1), request.query ? form.decodeForm(request.query) : undefined); } catch (error) { data = utf8Encode(`Internal Server Error\n\n${error?.message}\n${error?.stack}`); response.writeHead(500, {'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': data.length});