Sign inSign up

bbdrummer/dummy-responder

By bbdrummer

โ€ขUpdated about 1 year ago

Image
1

1.9K

bbdrummer/dummy-responder repository overview

โ ๐Ÿค– Dummy Responder Service

A lightweight, standalone HTTP service for testing and development with WebSocket and Server-Sent Events (SSE) support. Perfect for mocking APIs, simulating network conditions, and testing real-time communication.



โ ๐Ÿš€ Quick Start

# Run with Docker
docker run -p 8080:8080 bbdrummer/dummy-responder:latest

# Test basic functionality
curl http://localhost:8080/health

# Test with custom parameters
curl "http://localhost:8080/?responseCode=200&message=Hello&responseTime=1s"

โ โœจ Key Features

  • ๐Ÿ”ง Configurable HTTP responses - status codes, delays, failure rates
  • ๐ŸŒ WebSocket support - real-time message streaming
  • ๐Ÿ“ก Server-Sent Events (SSE) - live event streaming
  • ๐Ÿงช Built-in test page - interactive WebSocket & SSE testing
  • ๏ฟฝ OpenAPI/Swagger documentation - auto-generated API docs
  • ๏ฟฝ๐Ÿ“Š Multiple content types - JSON, plain text, HTML
  • โšก Zero dependencies - single binary, fast startup
  • ๐Ÿณ Container-ready - lightweight Alpine-based image (~10MB)

โ ๐Ÿ“– Usage Examples

โ HTTP API Testing
# Simple response
curl http://localhost:8080/

# Random status codes with 30% failure rate
curl "http://localhost:8080/?responseCode=random&failureRate=0.3"

# Simulate slow API (2 second delay)
curl "http://localhost:8080/?responseTime=2s&message=Slow%20API"

# Different content types
curl "http://localhost:8080/?contentType=text/plain&message=Plain%20text"
โ Real-time Communication Testing
# WebSocket (requires wscat: npm install -g wscat)
wscat -c "ws://localhost:8080/ws?message=Hello&wsInterval=2s"

# Server-Sent Events
curl -N "http://localhost:8080/sse?message=Live%20Events&sseInterval=1s"

# Interactive test page
open http://localhost:8080/test

โ ๐Ÿ”ง Configuration Parameters

ParameterDescriptionExamplesApplies To
responseCodeHTTP status code200, 404, 500, randomHTTP
responseTimeResponse delay100ms, 2s, randomHTTP
failureRateError probability (0-1)0.1 (10%), 0.5 (50%)HTTP
messageCustom messageHello World, API DownAll
contentTypeResponse formatapplication/json, text/plainHTTP
wsIntervalWebSocket message interval1s, 500ms, 5sWebSocket
sseIntervalSSE event interval1s, 2s, 10sSSE

โ ๐Ÿ› ๏ธ Available Endpoints

EndpointProtocolDescription
/HTTPConfigurable HTTP responses
/healthHTTPHealth check endpoint
/wsWebSocketReal-time message streaming
/sse, /eventsHTTPServer-Sent Events streaming
/testHTTPInteractive test page
/swagger/HTTPOpenAPI documentation

โ ๐ŸŽฏ Perfect For

  • API mocking during development
  • Network condition simulation (delays, failures)
  • Real-time feature testing (WebSocket, SSE)
  • Load testing baselines
  • CI/CD pipeline integration
  • Service discovery testing
  • Demo environments

โ ๐Ÿ—๏ธ Deployment Options

โ Docker
# Basic run
docker run -p 8080:8080 bbdrummer/dummy-responder

# With custom port
docker run -p 3000:8080 bbdrummer/dummy-responder

# Background with restart policy
docker run -d --restart unless-stopped -p 8080:8080 bbdrummer/dummy-responder
โ Docker Compose
version: '3.8'
services:
  dummy-responder:
    image: bbdrummer/dummy-responder:latest
    ports:
      - "8080:8080"
    restart: unless-stopped
โ Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
  name: dummy-responder
spec:
  replicas: 1
  selector:
    matchLabels:
      app: dummy-responder
  template:
    metadata:
      labels:
        app: dummy-responder
    spec:
      containers:
      - name: dummy-responder
        image: bbdrummer/dummy-responder:latest
        ports:
        - containerPort: 8080
        resources:
          requests:
            memory: "32Mi"
            cpu: "50m"
          limits:
            memory: "128Mi"
            cpu: "200m"
---
apiVersion: v1
kind: Service
metadata:
  name: dummy-responder
spec:
  selector:
    app: dummy-responder
  ports:
  - port: 80
    targetPort: 8080

โ ๐Ÿ“Š Response Formats

โ HTTP JSON Response
{
  "message": "Hello World",
  "requestInfo": {
    "method": "GET",
    "path": "/",
    "query": "responseCode=200&message=Hello"
  },
  "timestamp": "2025-08-30T09:17:30Z",
  "config": {
    "responseCode": 200,
    "failureRate": 0.1,
    "responseTime": "1s",
    "message": "Hello World"
  }
}
โ WebSocket Message
{
  "message": "Hello WebSocket",
  "counter": 1,
  "timestamp": "2025-08-30T09:17:30Z",
  "service": "dummy-responder",
  "type": "websocket"
}
โ SSE Event
id: 1
event: message
data: {"message":"Hello SSE","counter":1,"timestamp":"2025-08-30T09:17:30Z","service":"dummy-responder","type":"sse"}

โ ๐Ÿ” Health Check

curl http://localhost:8080/health
{
  "status": "healthy",
  "service": "dummy-responder",
  "timestamp": "2025-08-30T09:17:30Z"
}

โ ๐Ÿงช Interactive Testing

โ Built-in Test Interface

Visit http://localhost:8080/test in your browser for an interactive test page where you can:

  • Test WebSocket connections with custom parameters
  • Test SSE streams with configurable intervals
  • See real-time connection status and message logs
  • Easily experiment with different settings
โ API Documentation

Visit http://localhost:8080/swagger/ for complete OpenAPI documentation with:

  • Interactive API explorer - test endpoints directly from the docs
  • Request/response examples with proper schemas
  • Parameter descriptions and validation
  • Complete endpoint coverage including WebSocket and SSE

โ ๐Ÿ’ก Why Use Dummy Responder?

  1. ๐Ÿš€ Fast startup - Ready in milliseconds
  2. ๐Ÿชถ Lightweight - <10MB Docker image
  3. ๐Ÿ”ง Flexible - Configure everything via URL parameters
  4. ๐ŸŒ Real-time ready - WebSocket & SSE support built-in
  5. ๐Ÿงช Test-friendly - Built-in interactive test page
  6. ๐Ÿ“ฆ Zero config - No databases, no config files
  7. ๐Ÿ”„ Realistic - Simulates real-world network conditions

Perfect for developers who need a reliable, configurable service for testing and development! ๐ŸŽฏ

Visit http://responder.bjoernbartels.tech/โ  for complete developers' documentation.

Tag summary

Content type

Image

Digest

sha256:1dc0b91f9โ€ฆ

Size

28.1 MB

Last updated

about 1 year ago

docker pull bbdrummer/dummy-responder