supertest
supertest copied to clipboard
Error after setting "Content-Type" to "multipart/form-data" [ERR_INVALID_ARG_TYPE]
hey I was trying to test my express API endpoints as you see below:
test('POST: Send registration request', done => {
superTest(Api)
.post('/auth/register')
.set('Content-Type', 'multipart/form-data')
.send(fakeUser)
.expect('Content-Type', 'application/json; charset=utf-8')
.expect(200, done);
});
but I got this error after i set .set('Content-Type', 'multipart/form-data')
:
TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Object