Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 9c37213

Browse files
vmxdaviddias
authored andcommitted
fix(dag): use SendOneFile for dag put
There was a refactoring, now the usual way of doing a HTTP request is through SendOneFile.
1 parent 2683c7e commit 9c37213

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Diff for: src/dag/put.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ const dagCBOR = require('ipld-dag-cbor')
55
const promisify = require('promisify-es6')
66
const CID = require('cids')
77
const multihash = require('multihashes')
8+
const SendOneFile = require('../utils/send-one-file')
89

910
function noop () {}
1011

1112
module.exports = (send) => {
13+
const sendOneFile = SendOneFile(send, 'dag/put')
14+
1215
return promisify((dagNode, options, callback) => {
1316
if (typeof options === 'function') {
1417
return setImmediate(() => callback(new Error('no options were passed')))
@@ -44,16 +47,14 @@ module.exports = (send) => {
4447

4548
function finalize (err, serialized) {
4649
if (err) { return callback(err) }
47-
48-
send({
49-
path: 'dag/put',
50+
const sendOptions = {
5051
qs: {
5152
hash: hashAlg,
5253
format: format,
5354
'input-enc': inputEnc
54-
},
55-
files: serialized
56-
}, (err, result) => {
55+
}
56+
}
57+
sendOneFile(serialized, sendOptions, (err, result) => {
5758
if (err) {
5859
return callback(err)
5960
}

0 commit comments

Comments
 (0)