mock-server is a simple, universal and self-contained python HTTP server.

It is very simple to use. No fancy configuration or options. Everything has a default value.

It is universal because you don't have to configure paths. It will just respond to any URL for any request method, so you only need to change the response you want, not the mock.

It is a single self-contained python script. No need to install or anything complicated. Just execute it.


To serve on port 80, with return status 200 and message 'ok':

$ mock-server.py

To serve an empty JSON:

$ mock-server.py -d"{}"

To serve a JSON, XML or any text message

$ mock-server.py -f response.txt

To change the response status:

$ mock-server.py -s 500

To choose a server name and port:

$ mock-server.py -n myserver -p 8080

For help: $ mock-server.py -h

More information

For more information, new versions or bug reporting try the project page.