Skip to content

HeavyOpenSource/heavy-mock-http-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heavy Mock HTTP Server

Links:

Technologies:

📝 Description

This project is a mock HTTP server that can be used to simulate different HTTP responses. Let me list you some use cases:

  • You are developing a client application that consumes a server that is not ready yet
  • You are developing a client application that consumes an external service that is too expensive to call during development and testing
  • You are developing a client application that consumes an external service that is not reliable

🚀 Getting Started

🛠️ Configuration

The server uses a configuration file to define the routes and the responses that it should return. The configuration file is a YAML file that contains the following fields:

endpoints:
  - name: <string>
    request:
      methods:
        - GET | POST | PUT | DELETE | PATCH | OPTIONS | HEAD
      paths:
        - <regex>
      headers:
        <string>: <string>

    response:
      delay: <integer> # In milliseconds
      status: <HTTP_STATUS> # OK | CREATED | BAD_REQUEST | ...
      headers:
        <string>:
          - <string>

      body: # Only one field of body can be used
        # You can use the | character to write a multiline string
        string: <string>
        file: <string>

Notes: See the examples directory for more information

🐳 Docker Compose

The following example uses the configuration file basic-example.yml from the examples directory, if you want to use another configuration file, you must change the source field in the volumes section

version: '3.8'

services:
  heavy-mock-http-server:
    image: heavynimbus/heavy-mock-http-server:0.1.0
    ports:
      - "8080:80"
    volumes:
      - type: bind
        source: ./examples/single-endpoint.yml
        target: /etc/heavy-mock/config.yml
        read_only: true

About

Mocked HTTP server usefull for development or testing purposes

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages