#http #web-server #test

tubetti

Serve &[u8] data at a localhost url with minimal configuration

16 releases

Uses new Rust 2024

0.3.2 Feb 4, 2026
0.3.1 May 18, 2025
0.2.3 May 17, 2025
0.2.1 Apr 10, 2025
0.0.5 Feb 23, 2025

#674 in Testing

MIT/Apache

19KB
383 lines

Tubetti: small http tubes

No-fuss, low configuration webservers on demand

Features:

  • Convenience-focused development experience
  • Axum-based, can optionally be constructed from a Router
  • Supports ranged requests using axum-range
  • Supports custom headers using HeaderMap
  • Supports artifically slow response times with configurable delay

Example Usage

use tubetti::tube;

let body = std::sync::Arc::new("potatoes".as_bytes());
let tb = tube!(body).await.unwrap();
let client = reqwest::Client::new();
let response = client.get(tb.url()).send().await.unwrap();
assert_eq!(response.headers().get("accept-ranges").unwrap(), "bytes");
assert_eq!(response.headers().get("content-length").unwrap(), "8");
assert_eq!(response.bytes().await.unwrap(), "potatoes".as_bytes());
tb.shutdown().await.unwrap();

Please take a look at the examples for more detailed usage information.

License

MIT OR Apache-2.0

Dependencies

~10–14MB
~179K SLoC