2

Uploading a file in an integration test as follows:

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()
            })

The content type of the multipart file is: application/octet-stream and I need it to be image/png. How can I set that?

Jasper Blues
  • 28,258
  • 22
  • 102
  • 185

0 Answers0