How to add a csv file in fixtures folder as form data in my POST cy.request

Viewed 26

Iam having a csv file in fixture folder in cypress. I need to add that file as form data in POST request body Key data_file. I have given the code below.

                method: 'POST',
                url: 'https://someUrI',
                headers: {
                    "apikey": "@44$bfdfbGD",
                },
                body:{   
                    "date":"2022-02-02",
                    "data_file":*******filePath*******needs to add fixture file csv here as file
                }

            })

In Postman Iam sending as file not text

enter image description here

How to add as file in my code now

0 Answers
Related