Complete the code to set the Content-Type header for an x-www-form-urlencoded request in Postman.
pm.request.headers.add({ key: 'Content-Type', value: '[1]' });The Content-Type header must be set to application/x-www-form-urlencoded to send data in this format.
Complete the code to add a key-value pair to the x-www-form-urlencoded body in Postman.
pm.request.body.urlencoded.add({ key: '[1]', value: 'testValue' });When adding form data, the key should be the name of the form field, like 'username'.
Fix the error in the code to correctly clear all existing x-www-form-urlencoded body parameters in Postman.
pm.request.body.urlencoded.[1]();The correct method to clear all parameters is clear().
Fill both blanks to correctly update the value of a key in the x-www-form-urlencoded body in Postman.
const param = pm.request.body.urlencoded.find(item => item.key === '[1]'); if (param) { param.value = '[2]'; }
We look for the key 'sessionId' and update its value to 'abcdef'.
Fill all three blanks to create a new x-www-form-urlencoded body with two parameters in Postman.
pm.request.body.update({
mode: '[1]',
urlencoded: [
{ key: '[2]', value: 'value1' },
{ key: '[3]', value: 'value2' }
]
});The mode must be 'urlencoded' to send form data. The keys are 'email' and 'password' as typical form fields.