0.01
No commit activity in last 3 years
No release in over 3 years
Cli tool to make inspecting and recording HTTP requests fun again
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

~> 1.3
>= 0

Runtime

 Project Readme

ResponseMate

Gem version Code Climate Coverage Status Build Status

ResponseMate is a command line tool that helps inspecting and recording HTTP requests/responses from a terminal.

It is designed with APIs in mind.

Install

gem install response_mate

Commands

  • record
  • list
  • inspect
  • export
  • version

Usage

For a list of available commands run response_mate help
For help on a command run response_mate help some_command

Requests Manifest

Most ResponseMate's tasks depend on a manifest file where you declare the requests to be made.
The default filename of this manifest is requests.yml.
You may specify another file using the -r option. This file has to be in YAML format (but keep in mind that JSON is a valid compatible subset of YAML).

Example:

default_headers:
  accept: 'application/vnd.{{app_name}}.beta+json'
requests:
  -
    key: user_issues
    request:
      url: 'http://someapi.com/users/42/issues'
  -
    key: user_friends
    request:
      url: 'http://someapi.com/users/42/friends'
      params:
        since: 'childhood'
        honest: '{{are_my_friends_honest}}'

Expressions inside {{}} will be evaluated as Mustache templates using values from a file named environment.yml.

You may specify a different location for the environment file using the -e option.

Example:

response_mate inspect issues_show -e ./response_mate/production_environment.yml

If your requests manifest does not contain Mustache tags you don't need an environment file.

Environment File

In this file (default location: ./environment.yml) you may place variables to be used in the requests manifest. Where applicable you may configure the location of the environment file using the -e option.

Example

response_mate record -e ./github/production_environment.yml

This file has to be in YAML format (but keep in mind that JSON is a valid compatible subset of YAML).

# environment.yml
base_url: http://api.github.com
repo: rails/rails

Then in the requests manifest any values of keys declared in the environment file can be used as follows.

# requests.yml
requests:
  -
    key: repos_show
    url: {{base_url}}/repos/{{repo}}

Record

Records the responses of HTTP requests declared in a requests manifest file.

response_mate record

By default responses are stored in the current working directory, but the output directory is configurable using the -o option.

Default Behavior

Without any arguments / options it records all the keys of the requests manifest.

Recording Specific Key(s)

If you wish to record the responses of a subset of the declared requests in the requests manifest, you may use the -k option. You have to provide a space separated list of keys to be recorded.

response_mate record -k key1 key2

Custom Manifest Location

The requests are expected to be declared in a file named requests.yml in the current working directory.

You may have many request files to use for various purposes. To specify the one to be used you may supply the -r option.

response_mate record -r github_api.yml

Inspect

Performs the request and displays the output without recording

response_mate inspect some_key

List

Lists recording keys, prompting either to record or to inspect

response_mate list

Same as in the record command you may specify the output directory using the -o option.

Export

Exports either the requests manifest or the environment file to a different format (currently only postman is supported)

response_mate export

Export in pretty json

response_mate export -f postman -p

Custom Manifest Location

response_mate export -f postman -r github_requests.yml

Export the Environment File

response_mate export --resource=environment

Upload the exported and get a link

response_mate export --resource=environment --upload

Version

Displays the version

Licence

Released under the MIT License. See the LICENSE file for further details.