{"id":16445413,"url":"https://github.com/lloydmeta/rusqbin","last_synced_at":"2026-03-02T06:31:30.071Z","repository":{"id":57664876,"uuid":"78214356","full_name":"lloydmeta/rusqbin","owner":"lloydmeta","description":"A server that stashes your requests for later retrieval so you can do end-to-end testing of code that makes HTTP calls. Available as a binary, a Docker image, and a library.","archived":false,"fork":false,"pushed_at":"2017-09-01T14:16:30.000Z","size":5017,"stargazers_count":28,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-22T07:58:06.443Z","etag":null,"topics":["docker","mock-server","requestbin","restful","rust","testing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lloydmeta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-06T15:00:09.000Z","updated_at":"2025-10-03T12:36:20.000Z","dependencies_parsed_at":"2022-09-14T21:41:21.282Z","dependency_job_id":null,"html_url":"https://github.com/lloydmeta/rusqbin","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/lloydmeta/rusqbin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydmeta%2Frusqbin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydmeta%2Frusqbin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydmeta%2Frusqbin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydmeta%2Frusqbin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lloydmeta","download_url":"https://codeload.github.com/lloydmeta/rusqbin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lloydmeta%2Frusqbin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29994122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","mock-server","requestbin","restful","rust","testing"],"created_at":"2024-10-11T09:44:20.124Z","updated_at":"2026-03-02T06:31:30.053Z","avatar_url":"https://github.com/lloydmeta.png","language":"Rust","readme":"# Rusqbin [![Build Status](https://travis-ci.org/lloydmeta/rusqbin.svg?branch=master)](https://travis-ci.org/lloydmeta/rusqbin) [![Crates.io](https://img.shields.io/crates/v/rusqbin.svg)](https://crates.io/crates/rusqbin) [![](https://images.microbadger.com/badges/image/lloydmeta/rusqbin.svg)](https://microbadger.com/images/lloydmeta/rusqbin \"rusqbin docker image details\")\n\nRusqbin is a web server that stashes your requests for later retrieval. It is available as\na Docker image, a binary, and a library through [crates.io](https://crates.io/crates/rusqbin).\n\nRusdocs are published for:\n* [Master branch](http://beachape.com/rusqbin)\n* [Latest release](https://docs.rs/rusqbin)\n\n## Usage\n\n### Web API\n\nThe web server has the following API for dealing with request bins.\n\n  - `POST`    /rusqbins                    To create a bin and get back bin_id\n  - `GET`     /rusqbins                    To list bin summaries\n  - `GET`     /rusqbins/${bin_id}          To get bin-specific summary information\n  - `GET`     /rusqbins/${bin_id}/requests To get detailed request information for a bin (lists all requests in the bin)\n  - `DELETE`  /rusqbins/${bin_id}          To delete a bin\n\nIn any other case, send requests with a X-Rusqbin-Id header with a\nbin_id to have your requests logged to a bin for later retrieval.\n\n### Docker\n\n`$ docker run lloydmeta/rusqbin:latest`\n\n### Binary\n\nTo use Rusqbin as a binary, simply install it using `cargo install rusqbin` and then run `rusqbin`,\nand follow the simple usage instructions. The port the server runs on can be set by optionally adding a port argument.\n\n![Binary usage demo](https://raw.githubusercontent.com/lloydmeta/rusqbin/master/rusqbin-demo.gif)\n\nLogging is handled by [`env_logger`](https://github.com/rust-lang-nursery/log), so you can configure it at runtime using\na `RUST_LOG` environment variable.\n\n### Library\n\nTo use it as a library, add it to your project as [a crate dependency](https://crates.io/crates/rusqbin), then from within Rust code:\n\n```rust\nuse rusqbin::storage::*;\nuse rusqbin::server::*;\nuse rusqbin::models::*;\nuse hyper::{Method, Uri};\nuse hyper::client::Client;\nuse hyper::client::Request as HyperRequest;\nuse std::io::Read;\nuse std::thread;\nuse std::sync::{Arc, Mutex};\nuse std::str::FromStr;\nuse futures::future;\n\n// Start a BinsServer on port 7000 in another thread, utilising\n// a simple mutex for shutting it down. A channel could also work.\nlet server = Arc::new(BinsServer::new(7000, InMemoryBins::new()));\nlet arc_stay_alive = Arc::new(Mutex::new(true));\nlet bg_server = server.clone();\nlet bg_stay_alive = arc_stay_alive.clone();\nthread::spawn(move || {\n  bg_server.run_until(future::poll_fn(|| {\n    if *bg_stay_alive.lock().unwrap() {\n      Ok(futures::Async::NotReady)\n    } else {\n      Ok(futures::Async::Ready(()))\n    }\n  }))\n});\n\nlet mut client_core = tokio_core::reactor::Core::new().unwrap();\nlet client = Client::new(\u0026client_core.handle());\n\n// Create a bin via programmatically, making sure to scope the\n// storage unlocking with braces properly\nlet bin = {\n  let mut server_storage = server.storage.lock().unwrap();\n  server_storage.create_bin()\n};\nlet bin_id = bin.id.value();\n\n// Fire an HTTP request with the proper X-Rusqbin-Id header\nlet mut req = HyperRequest::new(Method::Post, Uri::from_str(\"http://localhost:7000/hello/world\").unwrap());\nreq.headers_mut().set(XRusqBinId(bin_id.to_owned()));\nlet future_resp = client.request(req);\n\n// Here we use core.run to block on response, but you should never\n// do this in production code.\nclient_core.run(future_resp);\n// Check to make sure our HTTP request was received and stashed\n// in our rusqbin server\n{\n  let mut server_storage = server.storage.lock().unwrap();\n  let bin_requests: \u0026Bin = server_storage.get_bin(\u0026bin.id).unwrap();\n  let req = \u0026bin_requests[0];\n  assert_eq!(req.method, \"POST\".to_owned());\n  assert_eq!(req.path, \"/hello/world\".to_owned());\n}\n// Cleanup by shutting down our server using the mutex\n*arc_stay_alive.lock().unwrap() = false;\n```\n\nIn the example above, we use the out-of-the-box `InMemoryBins` for storage, but you can pass any given implementation of\n`rusqbin::storage::Bins` when creating a BinsServer.\n\n## Credit\n\nRusqbin is a simple port of [Requestbin](https://requestb.in/) written in Rust. Inspired by [Requestinator](https://github.com/DonMcNamara/requestinator)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flloydmeta%2Frusqbin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flloydmeta%2Frusqbin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flloydmeta%2Frusqbin/lists"}