Skip to content

Commit

Permalink
replace node:url.parse to qs.parse
Browse files Browse the repository at this point in the history
added qs package
set version 1.1.0
  • Loading branch information
sanchezzzhak committed Jun 24, 2024
1 parent d157f88 commit 08db6c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-moleculer-web",
"version": "1.0.0",
"version": "1.1.0",
"description": "Fast web app service for moleculer.js + uWebSockets.js",
"main": "src/index.js",
"repository": {
Expand All @@ -14,6 +14,7 @@
"dependencies": {
"ejs": "^3.1.9",
"moleculer": "^0.14.32",
"qs": "^6.12.1",
"uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.42.0"
},
"engines": {
Expand Down
8 changes: 2 additions & 6 deletions src/request-data.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const url= require('node:url');
const qs= require('qs');

/** @typedef {import("uWebSockets.js").HttpRequest} HttpRequest */
/** @typedef {import("uWebSockets.js").HttpResponse} HttpResponse */
Expand All @@ -25,11 +25,7 @@ class RequestData {
this.ip = Buffer.from(res.getRemoteAddressAsText()).toString();
this.ipProxy = Buffer.from(res.getProxiedRemoteAddressAsText()).toString();
this.queryRaw = req.getQuery() ?? '';
this.query = url.parse(
`?${this.queryRaw}`,
true,
false
).query ?? {};
this.query = qs.parse(`?${this.queryRaw}`) ?? {};
this.referer = req.getHeader('referer') ?? '';
this.url = req.getUrl();
this.userAgent = req.getHeader('user-agent') ?? '';
Expand Down

0 comments on commit 08db6c6

Please sign in to comment.