Skip to content

An HTTP and WebSocket "echo" server for testing proxies and HTTP clients.

Notifications You must be signed in to change notification settings

pagarme/static-response-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Static Response Server

A very simple static HTTP server with support for web-sockets.

  • Any request, independent of content, will always return a static body and content type.
  • Any message sent from a web-socket client will be replied with same static response.
  • Visit /.ws for a basic UI to connect and send web-socket messages.
  • The CONTENT_TYPE and CONTENT_BODY defines response's content type and body.
  • The PORT environment variable sets the server port.
  • No TLS support yet :(

To run as a container:

docker run --env CONTENT_TYPE=application/json \
           --env CONTENT_BODY='{"upstream": "production"}' \
           --detach -P pagarme/static-response-server

Also works great with docker-compose:

services:
  production:
    image: pagarme/static-response-server
    environment:
      - PORT=8080
      - CONTENT_TYPE=application/json
      - CONTENT_BODY={"upstream":"production"}
    ports:
      - "8080:8080"

  sandbox:
    image: pagarme/static-response-server
    environment:
      - PORT=8081
      - CONTENT_TYPE=application/json
      - CONTENT_BODY={"upstream":"sandbox"}
    ports:
      - "8081:8081"

About

An HTTP and WebSocket "echo" server for testing proxies and HTTP clients.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 80.4%
  • Makefile 19.6%