echo-rs

Crates.ioecho-rs
lib.rsecho-rs
version0.2.0
sourcesrc
created_at2023-06-09 22:00:17.162208
updated_at2023-06-29 20:38:32.631137
descriptionA simple HTTP echo server
homepagehttps://github.com/the-wondersmith/echo-rs
repositoryhttps://github.com/the-wondersmith/echo-rs
max_upload_size
id886600
size93,120
Mark S. (the-wondersmith)

documentation

README

echo-rs

crate documentation

echo-rs provides a dead-simple HTTP echo server - i.e. it simply parrots back any request it receives in a developer-friendly JSON-serialized format.

It aims to provide a simple and convenient utility to assist in designing new applications, developing / testing API clients, or as a "dummy" workload for use in scaffolding new Kubernetes / cloud-native services.

License

AGPL-3.0-or-later

Features

echo-rs provides:

  • A simple HTTP echo server, returning a JSON-serialized representation of any request made to it

  • Prometheus metrics (helpful when using echo-rs as a dummy workload when designing new Kubernetes services)

Basic Usage

Run the server locally -

docker run -it -p 8080:8080 --rm docker.io/thewondersmith/echo-rs:latest --metrics=false --log-level=debug

Then make a request to it with any HTTP client -

curl -X POST \
  "http://localhost:8080/some/super-cool/endpoint?param1=some-param-value&param2=another-param-value" \
  -H 'Content-Type: application/json' \
  -H 'App-Specific-Header: app_specific_value' \
  -d '{"target": "echo-rs", "expected": "response", "some": ["more", "none", null], "nested": {"turtles": {"all": {"the": {"way": "down"}}}}}'

echo-rs should return the JSON-serialized representation of the request -

{
  "method": "POST",
  "path": "/some/super-cool/endpoint",
  "headers": {
    "user-agent": "curl/7.87.0",
    "host": "localhost:8080",
    "accept": "*/*",
    "content-type": "application/json",
    "app-specific-header": "app_specific_value",
    "content-length": "135"
  },
  "params": {
    "param1": "some-param-value",
    "param2": "another-param-value"
  },
  "body": {
    "expected": "response",
    "nested": {
      "turtles": {
        "all": {
          "the": {
            "way": "down"
          }
        }
      }
    },
    "some": [
      "more",
      "none",
      null
    ],
    "target": "echo-rs"
  }
}

TODO:

  • Tests 😅
Commit count: 10

cargo fmt