I’m using testcafe API to make an API request. I need to use form data as the body of the post request. (The request looks something similar to ‘curl -F username=xxx -F password=xxx https://xxxxx/api/login)
const response = await t.request.post({
url: "https://xxxxx/api/login",
body: {'username': 'xxx', 'password':'xxxx'},
headers: { "content-type": "multipart/form-data" }
});
console.log(JSON.stringify(response));
}
This question may look similar to my requirement. But I dont need a ‘Form’ option. I just want to make a post request with form data.