Rusqbin
Rusqbin is a web server that stashes your requests for later retrieval. It is available as a Docker image, a binary, and a library through crates.io.
Rusdocs are published for:
Usage
Web API
The web server has the following API for dealing with request bins.
POST
/rusqbins To create a bin and get back bin_idGET
/rusqbins To list bin summariesGET
/rusqbins/${bin_id} To get bin-specific summary informationGET
/rusqbins/${bin_id}/requests To get detailed request information for a bin (lists all requests in the bin)DELETE
/rusqbins/${bin_id} To delete a bin
In any other case, send requests with a X-Rusqbin-Id header with a bin_id to have your requests logged to a bin for later retrieval.
Docker
$ docker run lloydmeta/rusqbin:latest
Binary
To use Rusqbin as a binary, simply install it using cargo install rusqbin
and then run rusqbin
,
and follow the simple usage instructions. The port the server runs on can be set by optionally adding a port argument.
Logging is handled by env_logger
, so you can configure it at runtime using
a RUST_LOG
environment variable.
Library
To use it as a library, add it to your project as a crate dependency, then from within Rust code:
use *;
use *;
use *;
use ;
use Client;
use Request as HyperRequest;
use Read;
use thread;
use ;
use FromStr;
use future;
// Start a BinsServer on port 7000 in another thread, utilising
// a simple mutex for shutting it down. A channel could also work.
let server = new;
let arc_stay_alive = new;
let bg_server = server.clone;
let bg_stay_alive = arc_stay_alive.clone;
spawn;
let mut client_core = new.unwrap;
let client = new;
// Create a bin via programmatically, making sure to scope the
// storage unlocking with braces properly
let bin = ;
let bin_id = bin.id.value;
// Fire an HTTP request with the proper X-Rusqbin-Id header
let mut req = new;
req.headers_mut.set;
let future_resp = client.request;
// Here we use core.run to block on response, but you should never
// do this in production code.
client_core.run;
// Check to make sure our HTTP request was received and stashed
// in our rusqbin server
// Cleanup by shutting down our server using the mutex
*arc_stay_alive.lock.unwrap = false;
In the example above, we use the out-of-the-box InMemoryBins
for storage, but you can pass any given implementation of
rusqbin::storage::Bins
when creating a BinsServer.
Credit
Rusqbin is a simple port of Requestbin written in Rust. Inspired by Requestinator