带有环回组件存储的环回3挂在POST文件上

我有一个非常简单的服务器在环回3下运行,并再次看到这个问题: https : //github.com/strongloop/loopback-component-storage/issues/9

由于要点和例子不再工作,我想重新开放这个问题。 我已经创build了一个非常简单的API模板化服务器,并添加了以下代码:

module.exports = function (File) { File.upload = function (ctx, options, cb) { if (!options) options = {}; ctx.req.params.container = 'common'; console.log("DO"); File.app.models.Storage.upload(ctx.req, ctx.result, options, function (err, fileObj) { console.log("FILE"); cb(fileObj); }); }; File.remoteMethod( 'upload', { description: 'Uploads a file', accepts: [ {arg: 'ctx', type: 'object', http: {source: 'context'}}, {arg: 'options', type: 'object', http: {source: 'query'}} ], returns: { arg: 'fileObject', type: 'object', root: true }, http: {verb: 'post'} } ); }; 

现在的问题是,通过POSTMAN发布上传function,我看到在控制台中的以下行为:

 DO Error: Request aborted at IncomingMessage.<anonymous> (...../server/node_modules/formidable/lib/incoming_form.js:120:19) at emitNone (events.js:86:13) at IncomingMessage.emit (events.js:188:7) at abortIncoming (_http_server.js:383:9) at socketOnClose (_http_server.js:377:3) at emitOne (events.js:101:20) at Socket.emit (events.js:191:7) at TCP._handle.close [as _onclose] (net.js:504:12) FILE 

邮递员回复空白的回复

作为这个步骤的初学者,我完全失去了!

我的错在这里?

Thx任何input

OMG,看来我find了答案:

https://github.com/strongloop/loopback-component-storage/issues/86

只需使用值为“multipart / form-data”的Header“Accept”,不要设置“Content-type”。 这对Po​​stman来说是适合我的