The Request API can be used for form-data requests and the content-type used is: application/x-www-form-urlencoded
.
Sample request:
client.request.post("https://example.com/form", {
headers: {"Content-Type": "application/x-www-form-urlencoded"},
form: {
"name": "Tony Stark",
"age": 50,
"occupation": ["CEO", "Consultant", "Benefactor", "Mentor"]
}
}).then((data) => {
//success case
}).catch((error) => {
//failure case
});