supertest icon indicating copy to clipboard operation
supertest copied to clipboard

Error after setting "Content-Type" to "multipart/form-data" [ERR_INVALID_ARG_TYPE]

Open mehdi-ra opened this issue 3 years ago • 0 comments

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

mehdi-ra avatar Jun 26 '21 08:06 mehdi-ra