diff --git a/CHANGELOG.md b/CHANGELOG.md
index f9e8a0105..852c737f3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,13 @@
+
+# [22.2.0](https://github.com/ipfs/js-ipfs-api/compare/v22.1.1...v22.2.0) (2018-06-29)
+
+
+### Features
+
+* logs path & querystring for requests ([#796](https://github.com/ipfs/js-ipfs-api/issues/796)) ([4e55d19](https://github.com/ipfs/js-ipfs-api/commit/4e55d19))
+
+
+
## [22.1.1](https://github.com/ipfs/js-ipfs-api/compare/v22.1.0...v22.1.1) (2018-06-25)
diff --git a/package.json b/package.json
index 03134f751..d58ce77e6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ipfs-api",
- "version": "22.1.1",
+ "version": "22.2.0",
"description": "A client library for the IPFS HTTP API",
"leadMaintainer": "Alan Shaw ",
"main": "src/index.js",
@@ -79,7 +79,7 @@
"eslint-plugin-react": "^7.9.1",
"go-ipfs-dep": "~0.4.15",
"gulp": "^3.9.1",
- "interface-ipfs-core": "~0.69.0",
+ "interface-ipfs-core": "~0.69.1",
"ipfsd-ctl": "~0.37.3",
"pull-stream": "^3.6.8",
"socket.io": "^2.1.1",
@@ -96,6 +96,7 @@
"contributors": [
"Alan Shaw ",
"Alex Mingoia ",
+ "Alex Potsides ",
"Antonio Tenorio-Fornés ",
"Bruno Barbieri ",
"Clemo ",
@@ -151,7 +152,6 @@
"Vasco Santos ",
"Victor Bjelkholm ",
"Volker Mische ",
- "achingbrain ",
"dmitriy ryajov ",
"elsehow ",
"ethers ",
diff --git a/src/utils/send-request.js b/src/utils/send-request.js
index eb9ea6adc..81a10cc06 100644
--- a/src/utils/send-request.js
+++ b/src/utils/send-request.js
@@ -9,6 +9,7 @@ const once = require('once')
const streamToValue = require('./stream-to-value')
const streamToJsonValue = require('./stream-to-json-value')
const request = require('./request')
+const log = require('debug')('ipfs-api:request')
// -- Internal
@@ -23,6 +24,7 @@ function parseError (res, cb) {
if (payload) {
error.code = payload.Code
error.message = payload.Message || payload.toString()
+ error.type = payload.Type
}
cb(error)
})
@@ -35,6 +37,8 @@ function onRes (buffer, cb) {
const isJson = res.headers['content-type'] &&
res.headers['content-type'].indexOf('application/json') === 0
+ log(res.req.method, `${res.req.getHeaders().host}${res.req.path}`, res.statusCode, res.statusMessage)
+
if (res.statusCode >= 400 || !res.statusCode) {
return parseError(res, cb)
}
@@ -162,6 +166,7 @@ function requestAPI (config, options, callback) {
headers: headers,
protocol: `${config.protocol}:`
}
+
const req = request(config.protocol)(reqOptions, onRes(options.buffer, callback))
req.on('error', (err) => {
diff --git a/test/files.spec.js b/test/files.spec.js
index 160c73b56..05477c41b 100644
--- a/test/files.spec.js
+++ b/test/files.spec.js
@@ -457,10 +457,10 @@ describe('.files (the MFS API part)', function () {
it('files.stat file that does not exist()', (done) => {
ipfs.files.stat('/test-folder/does-not-exist()', (err, res) => {
expect(err).to.exist()
- if (err.code === 0) {
- return done()
- }
- throw err
+ expect(err.code).to.equal(0)
+ expect(err.type).to.equal('error')
+
+ done()
})
})
diff --git a/test/name.spec.js b/test/name.spec.js
index 93b371af9..b8a76d136 100644
--- a/test/name.spec.js
+++ b/test/name.spec.js
@@ -24,7 +24,7 @@ describe('.name', () => {
let testFileCid
before(function (done) {
- this.timeout(20 * 1000)
+ this.timeout(30 * 1000)
series([
(cb) => {
@@ -44,18 +44,22 @@ describe('.name', () => {
})
},
(cb) => {
- ipfsd.api.id((err, id) => {
- expect(err).to.not.exist()
- const ma = id.addresses[0]
- other.swarm.connect(ma, cb)
- })
- },
- (cb) => {
- ipfs.files.add(testfile, (err, res) => {
- expect(err).to.not.exist()
- testFileCid = res[0].hash
- cb()
- })
+ parallel([
+ (cb) => {
+ ipfs.id((err, id) => {
+ expect(err).to.not.exist()
+ const ma = id.addresses[0]
+ other.swarm.connect(ma, cb)
+ })
+ },
+ (cb) => {
+ ipfs.files.add(testfile, (err, res) => {
+ expect(err).to.not.exist()
+ testFileCid = res[0].hash
+ cb()
+ })
+ }
+ ], cb)
}
], done)
})
diff --git a/test/ping.spec.js b/test/ping.spec.js
index 097e40045..06848ee78 100644
--- a/test/ping.spec.js
+++ b/test/ping.spec.js
@@ -30,7 +30,7 @@ describe('.ping', function () {
let otherId
before(function (done) {
- this.timeout(20 * 1000) // slow CI
+ this.timeout(30 * 1000) // slow CI
series([
(cb) => {
@@ -50,18 +50,22 @@ describe('.ping', function () {
})
},
(cb) => {
- ipfsd.api.id((err, id) => {
- expect(err).to.not.exist()
- const ma = id.addresses[0]
- other.swarm.connect(ma, cb)
- })
- },
- (cb) => {
- other.id((err, id) => {
- expect(err).to.not.exist()
- otherId = id.id
- cb()
- })
+ parallel([
+ (cb) => {
+ ipfs.id((err, id) => {
+ expect(err).to.not.exist()
+ const ma = id.addresses[0]
+ other.swarm.connect(ma, cb)
+ })
+ },
+ (cb) => {
+ other.id((err, id) => {
+ expect(err).to.not.exist()
+ otherId = id.id
+ cb()
+ })
+ }
+ ], cb)
}
], done)
})