0
0
Postmantesting~10 mins

Raw body (text, XML) 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 raw body type to XML in Postman.

Postman
pm.request.body.mode = '[1]';
Drag options to blanks, or click blank then click option'
Araw
Bjson
Cformdata
Durlencoded
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'json' instead of 'raw' for XML raw body.
Setting mode to 'formdata' or 'urlencoded' which are not raw XML.
2fill in blank
medium

Complete the code to set the raw XML body content in Postman.

Postman
pm.request.body.raw = '[1]';
Drag options to blanks, or click blank then click option'
A<note><to>User</to></note>
B{"note": "User"}
Cto=User&from=Admin
D<note to='User'></note>
Attempts:
3 left
💡 Hint
Common Mistakes
Using JSON format instead of XML.
Using URL encoded string instead of raw XML.
3fill in blank
hard

Fix the error in setting the Content-Type header for XML raw body in Postman.

Postman
pm.request.headers.upsert({ key: 'Content-Type', value: '[1]' });
Drag options to blanks, or click blank then click option'
Amultipart/form-data
Bapplication/xml
Capplication/json
Dtext/plain
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'application/json' for XML body.
Using 'text/plain' which is generic and not specific to XML.
4fill in blank
hard

Fill both blanks to correctly set raw XML body and Content-Type header in Postman.

Postman
pm.request.body.mode = '[1]';
pm.request.headers.upsert({ key: 'Content-Type', value: '[2]' });
Drag options to blanks, or click blank then click option'
Axml
Bapplication/json
Capplication/xml
Draw
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatch between body mode and Content-Type header.
Using 'application/json' header for XML body.
5fill in blank
hard

Fill all three blanks to create a Postman test that checks if the response Content-Type is XML.

Postman
pm.test('Response is XML', () => {
  pm.response.to.have.header('[1]');
  pm.expect(pm.response.headers.get('[2]')).to.include('[3]');
});
Drag options to blanks, or click blank then click option'
AContent-Type
Capplication/xml
DAccept
Attempts:
3 left
💡 Hint
Common Mistakes
Checking wrong header like 'Accept'.
Checking for 'application/json' instead of 'application/xml'.