Git Product home page Git Product logo

echo's Introduction

Echo: everything you wanted to know about your HTTP request but didn't want to install a browser plugin to ask

Maybe you're writing a client for a web service and you want to test some new calls. Maybe you're writing a web service that talks to another web service. Maybe you just want to know.

Usage: server-side

Echo is a very simple Sinatra 1.4 application. It expects to be run via Puma, but any generic Rack application server will do. It has been tested with:

Echo's dependencies are installed just like any other garden-variety Rack application: with Bundler. For ease of deployment or execution, Puma also comes with a basic Procfile. You can run this anywhere you want using Forego or even a low-end tier on Heroku.

mckern@flexo echo (git:1.0.1) $ bundle install --path vendor/gems
Resolving dependencies...
Using backports 3.6.8
Using multi_json 1.10.1
Using puma 3.6.2
Using rack 1.6.5
Using tilt 2.0.5
Using bundler 1.13.7
Using rack-protection 1.5.3
Using rack-test 0.6.3
Using sinatra 1.4.7
Using sinatra-contrib 1.4.7
Bundle complete! 3 Gemfile dependencies, 10 gems now installed.
Bundled gems are installed into vendor/gems.
mckern@flexo echo (git:1.0.1) $

Usage: client-side

# Use curl to send a GET request to a generic example API endpoint
mckern@flexo ~ $ curl -H "Macguffin-Token: deadcafebeefbabe" "http://127.0.0.1:3000/example/endpoint"

And get back a valid, relatively easy-to-follow JSON hash with all the pertinent details of your dummy request:

{
  "content_length": null,
  "cookies": {
  },
  "host": "127.0.0.1",
  "ip": "127.0.0.1",
  "media_type": null,
  "params": {
    "splat": [
      "example/endpoint"
    ],
    "captures": [
      "example/endpoint"
    ]
  },
  "path": "/example/endpoint",
  "path_info": "/example/endpoint",
  "port": 3000,
  "query_string": "",
  "referer": null,
  "request_headers": {
    "macguffin_token": "deadcafebeefbabe"
  },
  "request_method": "GET",
  "scheme": "http",
  "script_name": "",
  "url": "http://127.0.0.1:3000/example/endpoint",
  "user_agent": "curl/7.37.1"
}

Support & contribution?

In the spirit of Jordan Sissel (a hero to admins and operations people everywhere), if Echo is not helping you debug weirdo random HTTP requests from your weirdo random clients, then there is a bug in Echo. Please open an issue or submit a pull request if something doesn't work.

License

Echo is licensed under the MIT License.

In computing, turning the obvious into the useful is a living definition of the word 'frustration'. โ€• Alan Perlis

Maintainer

Ryan McKern <[email protected]>

echo's People

Contributors

mckern avatar

Watchers

 avatar  avatar

echo's Issues

handle form params & inputs better

Right now, echo just dumps those into request_headers:

{ 
  "rack.request.form_hash": {
    "param1": "value1",
    "param2": "value2"
  },
  "rack.request.form_vars": "param1=value1&param2=value2",
  "rack.request.form_input": "#<StringIO:0x007fc559aee6f8>"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.