File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments