Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/dukeofharen/httplaceholder

A very flexible cross platform HTTP stub application.
https://github.com/dukeofharen/httplaceholder

Last synced: about 1 month ago
JSON representation

A very flexible cross platform HTTP stub application.

Lists

README

        



Logo


HttPlaceholder

Quickly stub away any HTTP service.




Report a Bug
ยท
Request a Feature
ยท Ask a Question



[![license](https://img.shields.io/github/license/dukeofharen/httplaceholder.svg?style=flat-square)](LICENSE)

[![PRs welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg?style=flat-square)](https://github.com/dukeofharen/httplaceholder/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
[![code with hearth by dukeofharen](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-dukeofharen-ff1414.svg?style=flat-square)](https://github.com/dukeofharen)
[![Docker pulls](https://img.shields.io/docker/pulls/dukeofharen/httplaceholder)](https://hub.docker.com/r/dukeofharen/httplaceholder)
[![Nuget downloads](https://img.shields.io/github/downloads/dukeofharen/httplaceholder/total?label=nuget)](https://www.nuget.org/packages/HttPlaceholder/)

Table of Contents

- [About](#about)
- [Built With](#built-with)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Example](#example)
- [Getting started](#getting-started)
- [Documentation](docs/docs.md)
- [Tools](#tools)
- [Roadmap](#roadmap)
- [Support](#support)
- [Project assistance](#project-assistance)
- [Contributing](#contributing)
- [Authors & contributors](#authors--contributors)
- [Security](#security)
- [License](#license)

---

## About

HttPlaceholder lets you stub away any HTTP webservice.

It was thought up while I was working at a company which had many interconnected webservices. The development process
was very painful, because it meant all the other webservices should also be started on my local dev PC, or I had to use
the "development" environment, which did not work for half of the time. HttPlaceholder fills this gap nicely.

HttPlaceholder:

* can easily be installed on your dev PC.
* can be used to easily create stubs, either as separate YAML files, through the API or through the user interface.
* can easily be hosted on any server.
* can use many different HTTP condition checkers and response writers to make your HTTP stubs as specific as you need.

Also visit the website: https://httplaceholder.org/

### Built With

- [.NET 8](https://dotnet.microsoft.com/apps/aspnet)
- [Vue.js](https://vuejs.org/)
- [Bootstrap](https://getbootstrap.com/)
- [CodeMirror](https://codemirror.net/)
- [ImageSharp](https://sixlabors.com/products/imagesharp/)

## Getting Started

### Prerequisites

Linux, Windows and Mac are supported.

### Installation

Follow these steps to install / update HttPlaceholder. If you update HttPlaceholder, make sure to read the [changelog](CHANGELOG) to see if there are no breaking changes.

**Install on Windows**

```powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/dukeofharen/httplaceholder/master/scripts/Install-Windows.ps1'))
```

**Install on Linux**

```bash
curl -o- https://raw.githubusercontent.com/dukeofharen/httplaceholder/master/scripts/install-linux.sh | bash
```

**Install on Mac**

```bash
curl -o- https://raw.githubusercontent.com/dukeofharen/httplaceholder/master/scripts/install-mac.sh | bash
```

**Docker**

HttPlaceholder has a Docker image; it can be found [here](https://hub.docker.com/r/dukeofharen/httplaceholder).

Run the following command to run a basic HttPlaceholder container: `docker run -p 5000:5000 dukeofharen/httplaceholder:latest`

**Install as .NET tool**

```bash
dotnet tool install --global HttPlaceholder
```

### Example

- Install HttPlaceholder (see [Installation](#installation)).
- Create a new .yaml file (e.g. `stub.yaml`).
- Copy and paste these contents in your new file:

```yml
- id: situation-01
conditions:
method: GET
url:
path:
equals: /users
query:
id:
equals: 12
filter:
equals: first_name
response:
statusCode: 200
text: |
{
"first_name": "John"
}
headers:
Content-Type: application/json
```

- 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.
![](docs/img/httplaceholder_running.png)

- Perform a specific HTTP call to HttPlaceholder so your provided response will be returned.
- For Linux / Mac (cURL needs to be installed):
```bash
curl "http://localhost:5000/users?id=12&filter=first_name" -D-
```
- For Windows (uses Powershell):
```powershell
(Invoke-WebRequest "http://localhost:5000/users?id=12&filter=first_name").RawContent
```

- You can view and inspect the performed requests in the user interface at .
![](docs/img/request_in_ui.png)

For more sophisticated examples, go to the [samples](docs/docs.md#samples) to view samples for all supported HTTP condition checkers and response writers. Learn more about HttPlaceholder by reading the [documentation](docs/docs.md).

## Documentation

- [Installation](docs/docs.md#installation)
- [Windows](docs/docs.md#windows)
- [Linux](docs/docs.md#linux)
- [Mac](docs/docs.md#mac)
- [Docker](docs/docs.md#docker)
- [Getting started](docs/docs.md#getting-started)
- [Stub samples](docs/docs.md#samples)
- [REST API](docs/docs.md#rest-api)
- [Configuration](docs/docs.md#configuration)
- [Request conditions](docs/docs.md#request-conditions)
- [Response writers](docs/docs.md#response-writers)
- [Management interface](docs/docs.md#management-interface)

### Tools
* [HttPlaceholder REST API client for .NET](docs/docs.md#httplaceholder-rest-api-client-for-net)

## Roadmap

See the [open issues](https://github.com/dukeofharen/httplaceholder/issues) for a list of proposed features (and known
issues).

- [Top Feature Requests](https://github.com/dukeofharen/httplaceholder/issues?q=label%3Aenhancement+is%3Aopen+sort%3Areactions-%2B1-desc) (Add your votes using the ๐Ÿ‘ reaction)
- [Top Bugs](https://github.com/dukeofharen/httplaceholder/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions-%2B1-desc) (Add your votes using the ๐Ÿ‘ reaction)
- [Newest Bugs](https://github.com/dukeofharen/httplaceholder/issues?q=is%3Aopen+is%3Aissue+label%3Abug)

## Support

Reach out to the maintainer at one of the following places:

- [GitHub discussions](https://github.com/dukeofharen/httplaceholder/discussions)
- The email which is located [in GitHub profile](https://github.com/dukeofharen)

## Project assistance

If you want to say **thank you** or/and support active development of HttPlaceholder:

- Add a [GitHub Star](https://github.com/dukeofharen/httplaceholder) to the project.
- Tweet about HttPlaceholder on your Twitter.
- Send me an email (see my [GitHub Profile](https://github.com/dukeofharen)).

## Contributing

First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an
amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are **greatly
appreciated**.

We have set up a separate document containing our [contribution guidelines](docs/CONTRIBUTING.md).

Thank you for being involved!

## Authors & contributors

The original setup of this repository is by [dukeofharen](https://github.com/dukeofharen) (https://ducode.org).

For a full list of all authors and contributors,
check [the contributor's page](https://github.com/dukeofharen/httplaceholder/contributors).

## Security

HttPlaceholder follows good practices of security, but 100% security can't be granted in software. HttPlaceholder is
provided **"as is"** without any **warranty**. Use at your own risk.

_For more info, please refer to the [security](docs/SECURITY.md)._

## License

This project is licensed under the **MIT license**.

See [LICENSE](LICENSE) for more information.