Sign inSign up

heavynimbus/heavy-mock-http-server

By heavynimbus

Updated about 2 years ago

Mock Server for development or testing purposes using Yaml configuration

Image
Networking
Developer tools
Web servers
0

128

heavynimbus/heavy-mock-http-server repository overview

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 need to change the HEAVY_MOCK_CONFIG environment variable and make sure that the file is in the /configs directory bound to the container

version: '3.8'

services:
  heavy-mock-http-server:
    image: heavynimbus/heavy-mock-http-server:0.0.1
    ports:
      - "8080:80"
    environment:
      - HEAVY_MOCK_CONFIG=/configs/single-endpoint.yml # The configuration file that the server should use
    volumes:
      - type: bind
        source: ./examples
        target: /configs
        read_only: true

Tag summary

Content type

Image

Digest

sha256:b34d4a03a

Size

277.5 MB

Last updated

about 2 years ago

docker pull heavynimbus/heavy-mock-http-server:0.1.0