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

Commit 58f0885

Browse files
committed
fix: bitswap wantlist http endpoint
1 parent eadcec0 commit 58f0885

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

src/cli/commands/bitswap/wantlist.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ module.exports = {
2626
if (err) {
2727
throw err
2828
}
29-
res.Keys.forEach((k) => console.log(k.toString()))
29+
res.Keys.forEach((cidStr) => {
30+
console.log(cidStr)
31+
})
3032
})
3133
})
3234
}

src/core/components/bitswap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const OFFLINE_ERROR = require('../utils').OFFLINE_ERROR
44

55
function formatWantlist (list) {
6-
return Array.from(list).map((e) => e[0])
6+
return Array.from(list).map((e) => e[1])
77
}
88

99
module.exports = function bitswap (self) {

src/http-api/resources/bitswap.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ exports.wantlist = (request, reply) => {
1010
let list
1111
try {
1212
list = request.server.app.ipfs.bitswap.wantlist()
13+
list = list.map((entry) => entry.cid.toBaseEncodedString())
1314
} catch (err) {
1415
return reply(boom.badRequest(err))
1516
}

test/cli/test-bitswap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const createTempNode = require('../utils/temp-node')
1010
const repoPath = require('./index').repoPath
1111
const ipfs = require('../utils/ipfs-exec')(repoPath)
1212

13-
describe('bitswap', () => {
13+
describe.only('bitswap', () => {
1414
let node
1515

1616
before((done) => {

0 commit comments

Comments
 (0)