Sign inSign up

waterlink/recorder

By waterlink

•Updated almost 11 years ago

Daemon that records all incoming HTTP request and allow to fetch them and put expectations on them.

Image
0

1.4K

waterlink/recorder repository overview

⁠Recorder Build Status

Simple application that records all incoming HTTP requests and writes them down to a filesystem in a conventional directory structure. Intended to be used in tests.

⁠Installation

⁠Via binary release

Go to releases⁠ page and download binary for your platform. Linux and Mac OS X are supported.

Optionally put this binary on your path (or use absolute/relative path to run it). All examples in usage section⁠ assume, that binary recorder is available on the path.

⁠Via go get tool

If you have properly configured Golang development environment, you can install recorder via:

go get -u github.com/waterlink/recorder
⁠Via docker

recorder is available as an automated build from docker hub⁠.

It is recommended to use a runner script⁠ as a recorder on your path. Assuming ~/bin is on your path:

curl -L https://github.com/waterlink/recorder/raw/master/dockerfiles/runner.sh > ~/bin/recorder
chmod a+x ~/bin/recorder

Then all examples from usage section⁠ should still work without modification.

⁠Usage

⁠Start the recorder daemon
recorder daemon

By default it uses port 9977 and binds to 0.0.0.0.

This can be changed by providing -l, --listen option, e.g.:

recorder daemon -l 127.0.0.1:3789   # or --listen=127.0.0.1:3789
⁠Get last recorded data by method & URL
recorder get POST /api/v2/user
⁠Get specific recorded data by method, URL & index

Use -i, --index option for that:

recorder get -i 2 POST /api/v2/user    # or --index=2
⁠Reset recorder
recorder reset
⁠Terminating daemon

It is enough to send _TERMINATE request to a server:

curl -X_TERMINATE localhost:9977

This command may fail with curl: (52) Empty reply from server, which should not be a problem, and typically should be ignored:

curl -X_TERMINATE localhost:9977 || true
⁠Expectations
⁠Expect equal last recorded data
recorder is POST /api/v2/user = "[email protected]&password=welcome"

is supports -i, --index option.

When expectation succeeds, is command returns exit code 0.

When expectation fails, is command returns exit code 1.

⁠Expect JSON path to be equal
recorder is --json-path=user/email POST /api/v2/user = "[email protected]"
⁠Usage design TODO
  • Design header manipulation commands/options.

⁠Contributing

  1. Fork it ( https://github.com/waterlink/recorder/fork⁠ )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

⁠Contributors

⁠License

MIT license. Read here⁠.

Tag summary

Content type

Image

Digest

Size

58 MB

Last updated

almost 11 years ago

docker pull waterlink/recorder