David
David

Reputation: 175

File in Postman Request Body is not Saved in the Collection

I have a POST request which validates a text/csv file in the request body. The request runs successfully in postman: returns HTTP code 200. The Request Body in the Postman Console is populated with the file path and name i.e. src:"/Users/username/Downloads/demo_file.csv" however when the collection is exported the file value in the request is empty. See below.

Question. Why is it empty, is this a bug / known issue?

                    "key": "Content-Type",
                    "name": "Content-Type",
                    "value": "text/csv",
                    "type": "text"
                }
            ],
            "body": {
                "mode": "file",
                "file": {}

As a quick test, I added the file to the same location as the postman collection and updated the value i.e. "file": {demo_file.csv} but the file was not found when the collection was run using newman.

Question: Should the relative path be used?

Upvotes: 2

Views: 1789

Answers (1)

Divyang Desai
Divyang Desai

Reputation: 7864

First of all, due to security reasons, Postman runner doesn't support file uploading directly. Find further detail at here.

Question. Why is it empty, is this a bug / known issue?

No, that is not a bug nor the issue, it is by designed.

Question: Should the relative path be used?

If your file on the same location where collection is located; you just need to give file name without braces as follows,

"mode": "file",
"file": "demo_file.csv"

Upvotes: 2

Related Questions