https://github.com/jclem/http-sponge
an http sponge that logs request data to stdout
https://github.com/jclem/http-sponge
Last synced: 10 months ago
JSON representation
an http sponge that logs request data to stdout
- Host: GitHub
- URL: https://github.com/jclem/http-sponge
- Owner: jclem
- Created: 2014-03-24T22:35:59.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-03-25T20:14:30.000Z (about 12 years ago)
- Last Synced: 2025-03-24T10:52:52.074Z (about 1 year ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# http-sponge
Listen for requests of any type and log request body and metadata to standard
out.
## Install
```sh
$ git clone git@github.com:jclem/http-sponge.git
$ cd http-sponge
$ npm install
$ npm start
```
## Deploy to Heroku
```sh
$ hk create
$ git push heroku master
```
## Usage
http-sponge is useful when you need to deal with callbacks that happen on an
external server that obviously can't send requests to your local apps in
development.
Tell your app to direct callback requests at your instance of `http-sponge` on
heroku. http-sponge will log your requests in a key-value format which can be
parsed by the `bin/mop` script. `bin/mop` accepts a string to match URLs against
(you might want to add UUIDs to your callback URL in some way to identify the
requests you want forwarded via grep), and a port to forward requests to on your
localhost:
```sh
$ hk log | grep --line-buffered my-route-to-forward | bin/mop 5000
```
Now, requests that your non-local app make to your instance of http-sponge will
be forwarded along to your local app.
## Limits
`bin/mop` forwards the following:
- Request URL
- Headers (the `host` header is removed)
- Method
- Body (only JSON is supported)