diff --git a/src/core/ipns/index.js b/src/core/ipns/index.js index 6a9d710fd7..e693e21f0f 100644 --- a/src/core/ipns/index.js +++ b/src/core/ipns/index.js @@ -77,9 +77,7 @@ class IPNS { const result = this.cache.get(id) if (result) { - return callback(null, { - path: result - }) + return callback(null, result) } } @@ -91,9 +89,7 @@ class IPNS { log(`IPNS record from ${name} was resolved correctly`) - callback(null, { - path: result - }) + callback(null, result) }) } diff --git a/src/http/api/resources/name.js b/src/http/api/resources/name.js index 9a4182f42e..92dd206484 100644 --- a/src/http/api/resources/name.js +++ b/src/http/api/resources/name.js @@ -17,7 +17,7 @@ exports.resolve = { const res = await ipfs.name.resolve(arg, request.query) return h.response({ - Path: res.path + Path: res }) } } diff --git a/test/core/name.js b/test/core/name.js index d9c1084ccf..bb0456ab70 100644 --- a/test/core/name.js +++ b/test/core/name.js @@ -34,7 +34,7 @@ const publishAndResolve = (publisher, resolver, ipfsRef, publishOpts, nodeId, re expect(err).to.not.exist() expect(res[0]).to.exist() expect(res[1]).to.exist() - expect(res[1].path).to.equal(ipfsRef) + expect(res[1]).to.equal(ipfsRef) callback() }) } @@ -117,7 +117,7 @@ describe('name', function () { ], (err, res) => { expect(err).to.not.exist() expect(res[2]).to.exist() - expect(res[2].path).to.equal(ipfsRef) + expect(res[2]).to.equal(ipfsRef) done() }) }) @@ -136,7 +136,7 @@ describe('name', function () { ], (err, res) => { expect(err).to.not.exist() expect(res[2]).to.exist() - expect(res[2].path).to.equal(`/ipns/${nodeId}`) + expect(res[2]).to.equal(`/ipns/${nodeId}`) done() }) }) @@ -277,7 +277,7 @@ describe('name', function () { ], (err, res) => { expect(err).to.not.exist() expect(res[2]).to.exist() - expect(res[2].path).to.equal(ipfsRef) + expect(res[2]).to.equal(ipfsRef) done() }) }) @@ -618,43 +618,4 @@ describe('name', function () { done() }) }) - - describe('working with dns', function () { - let node - let ipfsd - - before(function (done) { - df.spawn({ - exec: IPFS, - args: [`--pass ${hat()}`, '--offline'], - config: { Bootstrap: [] } - }, (err, _ipfsd) => { - expect(err).to.not.exist() - ipfsd = _ipfsd - node = _ipfsd.api - done() - }) - }) - - after((done) => ipfsd.stop(done)) - - it('should resolve ipfs.io', async () => { - const r = await node.name.resolve('ipfs.io', { recursive: false }) - return expect(r).to.eq('/ipns/website.ipfs.io') - }) - - it('should resolve /ipns/ipfs.io recursive', async () => { - const r = await node.name.resolve('ipfs.io', { recursive: true }) - - return expect(r.substr(0, 6)).to.eql('/ipfs/') - }) - - it('should fail to resolve /ipns/ipfs.a', async () => { - try { - await node.name.resolve('ipfs.a') - } catch (err) { - expect(err).to.exist() - } - }) - }) })