0
0
Postmantesting~10 mins

x-www-form-urlencoded body in Postman - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the Content-Type header for an x-www-form-urlencoded request in Postman.

Postman
pm.request.headers.add({ key: 'Content-Type', value: '[1]' });
Drag options to blanks, or click blank then click option'
Amultipart/form-data
Bapplication/x-www-form-urlencoded
Ctext/plain
Dapplication/json
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'application/json' instead of 'application/x-www-form-urlencoded'.
Forgetting to set the Content-Type header.
2fill in blank
medium

Complete the code to add a key-value pair to the x-www-form-urlencoded body in Postman.

Postman
pm.request.body.urlencoded.add({ key: '[1]', value: 'testValue' });
Drag options to blanks, or click blank then click option'
AAuthorization
BContent-Type
Cusername
DAccept
Attempts:
3 left
💡 Hint
Common Mistakes
Using header names like 'Content-Type' as form keys.
Leaving the key empty.
3fill in blank
hard

Fix the error in the code to correctly clear all existing x-www-form-urlencoded body parameters in Postman.

Postman
pm.request.body.urlencoded.[1]();
Drag options to blanks, or click blank then click option'
Aclear
BremoveAll
CdeleteAll
Dreset
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like 'removeAll' or 'deleteAll'.
Trying to assign an empty array instead of calling a method.
4fill in blank
hard

Fill both blanks to correctly update the value of a key in the x-www-form-urlencoded body in Postman.

Postman
const param = pm.request.body.urlencoded.find(item => item.key === '[1]');
if (param) { param.value = '[2]'; }
Drag options to blanks, or click blank then click option'
AsessionId
Btoken
C12345
Dabcdef
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up keys and values.
Using a numeric value when a string is expected.
5fill in blank
hard

Fill all three blanks to create a new x-www-form-urlencoded body with two parameters in Postman.

Postman
pm.request.body.update({
  mode: '[1]',
  urlencoded: [
    { key: '[2]', value: 'value1' },
    { key: '[3]', value: 'value2' }
  ]
});
Drag options to blanks, or click blank then click option'
Aurlencoded
Bemail
Cpassword
Dformdata
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'formdata' mode instead of 'urlencoded'.
Using incorrect keys that don't match form fields.