Skip to content

Status 400 when i try to attach multipart pdf files type form data #264

Open
@Krzeminska

Description

@Krzeminska

I'm trying to ask in this way:

request.post('/properUrl')
                .set('Content-Type', 'multipart/form-data')
                .set('Accept', 'application/json')
                .attach('file', './files/test.pdf', 'test.pdf')
                .type('formData')
                .then((response) => {
                    expect(response).to.have.status(200);
                })

I tried also with sending type of data in field: .field('type', 'formData')
and the server say's, it's not proper way (responses with 400).
Curl of proper request is:

curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json'  {"type":"formData"} '/properUrl'

Anyone knows what happen?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions