From 16067fd010f0984719260667d8f3a5652e313469 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Mon, 10 Jun 2024 13:49:57 +0100 Subject: [PATCH] RouterContext: Make .querystring portable, update docs --- Server/RouterContext.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Server/RouterContext.mjs b/Server/RouterContext.mjs index 9ee59c7..80db32d 100644 --- a/Server/RouterContext.mjs +++ b/Server/RouterContext.mjs @@ -19,7 +19,7 @@ class RouterContext { */ get querystring() { if(this.url.query == null) return {}; - return querystring.parse(this.url.query); + return querystring.parse(this.url.search.substring(1)); } constructor(in_request, in_response) { @@ -35,7 +35,12 @@ class RouterContext { this.response = in_response; /** * The parsed request URL - * @type {URL} + * + * The built-in Node.js `url` module (and NOT the browser-like `URL` class) is used for parsing URLs. + * + * See the `querystring` getter for a portable way to grab the parsed query string. + * + * @type {Url} */ this.url = url.parse(this.request.url, true); /**