0
0
Postmantesting~20 mins

Form-data body in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Form-data Body Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the purpose of using form-data body in Postman?

In Postman, when sending a request with a form-data body, what is the main purpose of using this type of body?

ATo send only plain text data without any keys.
BTo send raw JSON data as the request body.
CTo send URL encoded data in the request body.
DTo send key-value pairs where values can be files or text, typically used for file uploads.
Attempts:
2 left
💡 Hint

Think about when you need to upload files or send multiple fields with different types.

Predict Output
intermediate
2:00remaining
What is the Content-Type header when using form-data body in Postman?

When you select form-data body in Postman and send a request, what is the Content-Type header automatically set to?

Aapplication/json
Bapplication/x-www-form-urlencoded
Cmultipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Dtext/plain
Attempts:
2 left
💡 Hint

Form-data uses a special content type that includes a boundary string.

assertion
advanced
2:00remaining
Which assertion correctly verifies a file upload in Postman test script?

You want to write a Postman test script to check that the response confirms a file was uploaded successfully. Which assertion is correct?

Postman
pm.test('File upload success', () => {
    pm.response.to.have.status(200);
    pm.expect(pm.response.json().message).to.eql('File uploaded');
});
Apm.expect(pm.response.json().message).to.eql('File uploaded');
Bpm.expect(pm.response.text()).to.include('upload failed');
Cpm.expect(pm.response.code).to.be.above(400);
Dpm.expect(pm.response.json().fileName).to.exist;
Attempts:
2 left
💡 Hint

Look for the assertion that checks the success message exactly.

🔧 Debug
advanced
2:00remaining
Why does this Postman request with form-data body fail to send the file?

Given this Postman form-data body setup:

Key: "file" (type: File)
Value: (no file selected)

Why will the request fail to send the file?

ABecause the key name "file" is invalid for file uploads.
BBecause the file key is missing a selected file, so no file data is sent.
CBecause form-data cannot send files, only text.
DBecause the Content-Type header must be manually set to application/json.
Attempts:
2 left
💡 Hint

Check if the file input has a file selected.

framework
expert
3:00remaining
How to automate testing of form-data file uploads in Postman Collection Runner?

You want to automate testing of multiple file uploads using Postman Collection Runner. Which approach correctly supports this?

AUse a CSV file with file paths in a column and set the form-data file key to use the variable from the CSV.
BManually select each file in Postman before running the collection.
CUse raw JSON body with base64 encoded file content instead of form-data.
DSet the Content-Type header to application/x-www-form-urlencoded and send file paths as text.
Attempts:
2 left
💡 Hint

Think about how to parameterize file uploads in automated runs.