HttPlaceholder lets you stub away any HTTP webservice. HttPlaceholder:

Getting started

Let's take a look at a short demo.

1. Install HttPlaceholder

See Download.

2. Create a stub

Create a new .yaml file (e.g. stub.yaml).
Copy and paste these contents in your new file:
Copy script
- id: situation-01
  conditions:
    method: GET
    url:
      path:
        equals: /users
      query:
        id:
          equals: 12
        filter:
          equals: first_name
  response:
    statusCode: 200
    json: |
      {
        "first_name": "John"
      }

3. Start HttPlaceholder

Open the terminal in the folder you've added the stub.yaml file and run the following command: httplaceholder. HttPlaceholder will now start and will load the stubs in the current folder.
HttPlaceholder running in terminal

4. Perform a call to HttPlaceholder

Perform a specific HTTP call to HttPlaceholder so your provided response will be returned.

Copy script
curl "http://localhost:5000/users?id=12&filter=first_name" -D-
cURL call result
Copy script
wget -qSO - "http://localhost:5000/users?id=12&filter=first_name"
wget call result
Copy script
iwr "http://localhost:5000/users?id=12&filter=first_name"
PowerShell call result
Copy script
http "localhost:5000/users?id=12&filter=first_name"
PowerShell call result

5. View the requests

You can view and inspect the performed requests in the user interface at http://localhost:5000/ph-ui.

6. Learn more

For more sophisticated examples, go to the samples to view samples for all supported HTTP condition checkers and response writers. Learn more about HttPlaceholder by reading the documentation.

Command line images created with Carbon.

Posts / tutorials

More posts