Skip to content

Commit ec3b1d3

Browse files
committed
chore: add ability to check last called url
1 parent 6dd0f7f commit ec3b1d3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/client/.aegir.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,18 @@ const options = {
66
test: {
77
before: async () => {
88
let callCount = 0
9+
let lastCalledUrl = ''
910
const providers = new Map()
1011
const peers = new Map()
1112
const ipnsGet = new Map()
1213
const ipnsPut = new Map()
1314
const echo = new EchoServer()
1415
echo.polka.use(body.raw({ type: 'application/vnd.ipfs.ipns-record'}))
1516
echo.polka.use(body.text())
17+
echo.polka.use((req, res, next) => {
18+
next()
19+
lastCalledUrl = req.url
20+
})
1621
echo.polka.post('/add-providers/:cid', (req, res) => {
1722
callCount++
1823
providers.set(req.params.cid, req.body)
@@ -22,7 +27,6 @@ const options = {
2227
callCount++
2328
const records = providers.get(req.params.cid) ?? '[]'
2429
providers.delete(req.params.cid)
25-
2630
res.end(records)
2731
})
2832
echo.polka.post('/add-peers/:peerId', (req, res) => {
@@ -68,6 +72,9 @@ const options = {
6872
callCount = 0
6973
res.end()
7074
})
75+
echo.polka.get('/last-called-url', (req, res) => {
76+
res.end(lastCalledUrl)
77+
})
7178

7279
await echo.start()
7380

0 commit comments

Comments
 (0)