在集成测试中上传文件如下:
chai.request(server.instance)
.post('/profile/photo/0')
.set('Access-Token', accessToken)
.set('API-Key', testConfig.apiKey)
.set('Content-Type', 'image/png')
.field({contentId: 'foobar'})
.attach('file', fs.readFileSync(__dirname + '/file.png'), 'file')
.end((err, res) => {
console.log(JSON.stringify(res.body))
res.should.have.status(200)
done()
})
多部分文件的内容类型是:application/octet-stream
我需要它是image/png
。我该如何设置呢?
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)