0
0
Postmantesting~10 mins

Form-data 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 form-data key in Postman.

Postman
pm.request.body.formdata.add({ key: '[1]', value: 'test' });
Drag options to blanks, or click blank then click option'
Ausername
Bpassword
Ctoken
Demail
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'password' or 'token' as the key when username is expected.
2fill in blank
medium

Complete the code to check if the form-data body contains a key.

Postman
const hasKey = pm.request.body.formdata.has('[1]');
Drag options to blanks, or click blank then click option'
Aemail
Bsession
Cusername
Dauth
Attempts:
3 left
💡 Hint
Common Mistakes
Using keys like 'session' or 'auth' which may not exist in form-data.
3fill in blank
hard

Fix the error in the code to correctly set a form-data value.

Postman
pm.request.body.formdata.get('[1]').value = 'newValue';
Drag options to blanks, or click blank then click option'
Ausername
Bpassword
Ctoken
Demail
Attempts:
3 left
💡 Hint
Common Mistakes
Using keys that do not exist in form-data causing runtime errors.
4fill in blank
hard

Fill both blanks to add a new form-data key and value.

Postman
pm.request.body.formdata.add({ key: '[1]', value: '[2]' });
Drag options to blanks, or click blank then click option'
AapiKey
B12345
Ctoken
Dabcdef
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing keys and values incorrectly or using invalid tokens.
5fill in blank
hard

Fill all three blanks to update a form-data key's value and check its existence.

Postman
if (pm.request.body.formdata.has('[1]')) {
  pm.request.body.formdata.get('[2]').value = '[3]';
}
Drag options to blanks, or click blank then click option'
AsessionId
Cxyz789
Dtoken
Attempts:
3 left
💡 Hint
Common Mistakes
Using different keys in has() and get() causing errors.