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

Commit

Permalink
fix: bitswap wantlist http endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Dec 23, 2016
1 parent eadcec0 commit 58f0885
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/cli/commands/bitswap/wantlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ module.exports = {
if (err) {
throw err
}
res.Keys.forEach((k) => console.log(k.toString()))
res.Keys.forEach((cidStr) => {
console.log(cidStr)
})
})
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/bitswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const OFFLINE_ERROR = require('../utils').OFFLINE_ERROR

function formatWantlist (list) {
return Array.from(list).map((e) => e[0])
return Array.from(list).map((e) => e[1])
}

module.exports = function bitswap (self) {
Expand Down
1 change: 1 addition & 0 deletions src/http-api/resources/bitswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports.wantlist = (request, reply) => {
let list
try {
list = request.server.app.ipfs.bitswap.wantlist()
list = list.map((entry) => entry.cid.toBaseEncodedString())
} catch (err) {
return reply(boom.badRequest(err))
}
Expand Down
2 changes: 1 addition & 1 deletion test/cli/test-bitswap.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const createTempNode = require('../utils/temp-node')
const repoPath = require('./index').repoPath
const ipfs = require('../utils/ipfs-exec')(repoPath)

describe('bitswap', () => {
describe.only('bitswap', () => {
let node

before((done) => {
Expand Down

0 comments on commit 58f0885

Please sign in to comment.