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

Commit

Permalink
feat(object-http): support protobuf encoded values
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Aug 24, 2016
1 parent 08a4b19 commit 5f02303
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/http-api/resources/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,19 @@ exports.put = {
return reply("File argument 'data' is required").code(400).takeover()
}

const enc = request.query.inputenc

const parser = multipart.reqParser(request.payload)
var file

parser.on('file', (fileName, fileStream) => {
fileStream.on('data', (data) => {
file = data
if (enc === 'protobuf') {
const n = new DAGNode().unMarshal(data)
file = new Buffer(JSON.stringify(n.toJSON()))
} else {
file = data
}
})
})

Expand Down

0 comments on commit 5f02303

Please sign in to comment.