2

I am trying to send a GET request through postman using file URI scheme. An example:

file:///absolute/path/to/file.txt

The request works properly in any browser, but postman is failing with message:

Could not get any response

This seems to be like an error connecting to file:///absolute/path/to/file.txt

Is there any way to make postman work with file URIs?

3 Answers 3

3

Postman does not support file URIs, because the Chrome App platform does not allow direct access to files.

It should be easy to start a small HTTP server yourself though.. if you are on Mac/Linux, you can serve files in a directory using Python:

$ cd /path/to/directory/
$ python -m SimpleHTTPServer 1234

You can then visit

http://localhost:1234/filename

which will serve up the file.

1

Good answer.

I am not acquainted with SimpleHTTPServer, so I used live-server instead.

  1. I followed the instructions at 2. Install and Run a Local Web Server to install live-server.

  2. Then:

    cd /path/to/(myJSONfile.json)
    live-server <myJSONfile.json>

      and the JSON file was opened in my default web browser.

  1. Finally, in Postman I made a normal GET request, but on the address   http://127.0.0.1:8080.

It all worked just as intended.

1

In addition to czardoz's answer, for Python 3, SimpleHttpServer has been replaced by http.server. So, to serve the files using Python 3.x:

$ cd/path-to-directory/
$ python -m http.server 1234

Then, browse the file using:

http://localhost:1234/filename

Not the answer you're looking for? Browse other questions tagged or ask your own question.