The purpose of FakeServer is to respond to a request regardless of the route or method (POST, GET...) called, being mainly used as a server for tests during the development of an application.
- HTTP verb agnostic
- Sleep request by passing queryString
fs-sleepwith time in ms- Eg:
http://localhost:8088/my-super-test?fs-sleep=5000
- Eg:
- Status code agnostic by passing queryString
fs-status- Eg:
http://localhost:8088/my-super-test?fs-status=404
- Eg:
- Response contents:
- body
- errors
- headers
- method
- path
- query
- time
Inside a Docker, localhost is called:
http://host.docker.internal:8088
Request:
curl --request POST \
--url http://localhost:8088/cart/62582df20e2cd6a770aa9e5b \
--header 'Content-Type: application/json' \
--data '{
"cart_id": 123,
"items": [
{ "name": "Smartphone", "price": 155.99, "quantity": 1 },
{ "name": "Mouse", "price": 23.50, "quantity": 2 }
]}'Response:
{
"body": {
"cart_id": 123,
"items": [
{
"name": "Smartphone",
"price": 155.99,
"quantity": 1
},
{
"name": "Mouse",
"price": 23.5,
"quantity": 2
}
]
},
"errors": {},
"headers": {
"Accept": [ "*/*" ],
"Content-Length": [ "170" ],
"Content-Type": [ "application/json" ],
"User-Agent": [ "insomnia/2022.2.1" ]
},
"method": "POST",
"path": "/cart/62582df20e2cd6a770aa9e5b",
"query": {},
"time": "2022-04-14T19:13:21-03:00"
}You can access the latest releases page and download the compressed file according to your operating system.
You must have Golang installed to be able to make the build
$ git clone https://github.com/budnieswski/fake-server.git
$ cd fake-server
$ go build .
$ ./fake-server # Run application$ wget -q -O - https://github.com/budnieswski/fake-server/releases/latest/download/fake-server_Linux_x86_64.tar.gz \
| tar -xz
$ ./fake-server # Run application$ wget -q -O - https://github.com/budnieswski/fake-server/releases/latest/download/fake-server_macOS_arm64.tar.gz \
| tar -xz
$ ./fake-server # Run application$ wget -q -O - https://github.com/budnieswski/fake-server/releases/latest/download/fake-server_macOS_x86_64.tar.gz \
| tar -xz
$ ./fake-server # Run applicationYou can download the latest version here
- Create flags
- Help
- Version
- Run in background
- Custom port
- Create sleep request
- Create custom status code
- Add workflow to build app and create a release
- Linux
- MacOS
- Windows