[Postman] Upload file to s3 in pre-request script

First, select binary in the body settings, and assign a file at will.
Then the real file path will be obtained through the syntax in pre-script.

In some cases, you may need to set the file directory to Postman’s working directory first.

pm.request.body.update({
    mode: "file",
    file: {
        src: pm.environment.get("filePath")
    }
})
This entry was posted in Postman. Bookmark the permalink.