Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 3d234d9

Browse files
committed
fix: add url and qi to context
1 parent 6d0facb commit 3d234d9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const node =
6868
for (const [name, index] of ids)
6969
params[name] = req.getParameter(index)
7070

71-
const request = new Request(`http://a.aa${path}`, {
71+
const request = new Request(`http://a.aa${path}?${q}`, {
7272
body:
7373
method !== 'GET' && method !== 'HEAD'
7474
? await readStream(req, res)
@@ -82,13 +82,19 @@ export const node =
8282
headers: {}
8383
}
8484

85+
const url = request.url
86+
const s = url.indexOf('/', 11)
87+
const qi = url.indexOf('?', s + 1)
88+
8589
const context = {
8690
...app.decorators,
8791
set,
8892
params,
8993
store: app.store,
9094
request,
91-
query
95+
query,
96+
url,
97+
qi
9298
} as Context
9399

94100
for (let i = 0; i < app.event.request.length; i++) {

0 commit comments

Comments
 (0)