I want to use Postman to test an operation in my web API that accepts an Excel file.
How can I make a file available in a Postman test?
The file in question is around 10-50kb.
One way is to base64-encode it and store it as a variable, I can then use atob to get it back.
The second option is to store the file somewhere and use pm.sendRequest to download it (github, public s3 bucket, something else?)
The third option is to change my web API to either act as a file-server and vend the test files I need for testing.
I would prefer to just have an option to load the file from disk, but I don't think Postman javascript sandbox has an API to load files.
Related
I'm trying to host a static site through S3 and API Gateway (using S3 directly isn't an option due to security policy). One of the pages runs a client-side script to pull back a set of files from a specific folder on the server. I've set up the hosting following the Amazon tutorial.
For this to run, my script needs to be able to obtain the list of files for a specific folder.
If I was hosting the site on my own server using Apache, I could rely on the directory listing feature, where a GET on a folder with no index.html returns a file list. The tutorial suggests that this should be possible, but I can't seem to get it to work. If I submit a request to a particular {prefix}/{identifier}, I can retrieve the specific file, but sending a request to {prefix}/ returns an error.
Is there a way I can replicate directory listings so my Javascript can pull it down and read it, or is the only solution to write a server-side API in Lambda?
I have an API endpoint that accepts multipart/form-data file upload. I managed to upload a local file to it with Postman using the File option as below:
Now how can I upload a file that is hosted at a given URL using Postman without manually downloading it and then selecting its filename as in the above screenshot? I'm hoping to somehow GET the URL, store the binary data, and upload to the endpoint, all within a Postman collection.
One of the answers from Postman community issue:
Using Postman’s pre-request script:
Download the content from URL
Convert it to binary
Assign the binary value to a dynamic variable
Use the variable within your request
I am trying to get the cookies from a GET request when I first access a website via HTTP Request, there are a number of suggestions that suggest using user.properties files e.t.c. but I do not actually have these available as I am using the jMeter GUI to build the tests and it doesn't create these files.
Is there a way of getting the cookies from the header without the user.properties. Or if not, please could I request some detail as to how to achieve creating a user.properties file e.t.c. as I am very very new to jMeter.
Thanks in advance
For a simple caching you just need to add to Test Plan HTTP Cookie Manager and HTTP cookie(s) will be added.
user.properties is used for specific cases, and it is already exists in your JMeter bin folder in case you will need to update it.
I am using the Postman Collection Runner to automate a series of API calls. On one of these API calls I need to submit a binary file as the body of a POST. When setting up the Collection Runner I see how to select a file, but I can't figure out how to attach that file to the body of the POST request in the "Pre-request Script".
Is it possible in a "Pre-request Script" to load a binary file into the "data" object?
Currently postman collection runner doesn't support file uploads.
You will have to use newman to execute your Automation Test Suite(collection).
Have a look at this answer:
Postman - POST request with file upload
I am trying to send cookies to phantomjs while starting the driver
phanton.add_cookie({}) works.
I want to keep a list of cookies in a file and pass them as arguments while launching phantomjs
I found that webdriver.PhantomJS(service_args=['--cookies-file=/tmp/ph_cook.txt']) would add a given txt file at launch.
The problem is I do not know what format this txt file should be of. I tried using a map with key value pair, but no gain.
The cookie file format is a Qt internal serialization format of cookies. If you need such a cookie file, follow those instructions:
Create a PhantomJS script which sets the cookies that you need either using phantom.addCookie() or page.addCookie().
Run the previously written script as
$ phantomjs --cookies-file=cookies.txt script.js
Use the generated cookies file in python.