0
0
Postmantesting~10 mins

Binary file upload 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 request method for uploading a binary file in Postman.

Postman
pm.request.method = '[1]';
Drag options to blanks, or click blank then click option'
AGET
BPOST
CPUT
DDELETE
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET instead of POST for uploading files.
2fill in blank
medium

Complete the code to set the request body mode to binary in Postman.

Postman
pm.request.body.mode = '[1]';
Drag options to blanks, or click blank then click option'
Abinary
Bformdata
Craw
Durlencoded
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'raw' or 'formdata' instead of 'binary' for file uploads.
3fill in blank
hard

Fix the error in the code to correctly assign the binary file path in Postman.

Postman
pm.request.body.binary = { 'src': '[1]' };
Drag options to blanks, or click blank then click option'
A/path/to/file.jpg
Bfile_path
Cfilepath
DfilePath
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names instead of actual file path strings.
4fill in blank
hard

Fill both blanks to set the Content-Type header correctly for a binary file upload in Postman.

Postman
pm.request.headers.add({ key: '[1]', value: '[2]' });
Drag options to blanks, or click blank then click option'
AContent-Type
Bapplication/json
Capplication/octet-stream
DAccept
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Accept' instead of 'Content-Type' as the header key.
Using 'application/json' instead of 'application/octet-stream'.
5fill in blank
hard

Fill all three blanks to write a test script that checks if the binary file upload response status is 200 and content-type is correct.

Postman
pm.test('Upload successful', () => {
  pm.response.to.have.status([1]);
  pm.expect(pm.response.headers.get('[2]')).to.eql('[3]');
});
Drag options to blanks, or click blank then click option'
A200
BContent-Type
Capplication/octet-stream
D201
Attempts:
3 left
💡 Hint
Common Mistakes
Using status 201 which means created but not always returned.
Checking wrong header keys or values.