If the request needs to be of type application/x-www-form-urlencoded
:
const options = {
url: 'http://some/url',
method: 'POST',
header: {
'Accept': '*/*',
'Content-Type': 'application/x-www-form-urlencoded',
},
body: {
mode: 'urlencoded',
urlencoded : [
{ key: 'loginIdentity', value: 'admic'},
{ key: 'password', value: 'abc123'},
]
}
};
pm.sendRequest(options, function (err, res) {
// Use the err and res
// ...
pm.environment.set("my-token", res.json().access_token);
});
Postman Javascript API references:
- Request
- RequestBody