1 unstable release
0.1.0 | Feb 11, 2020 |
---|
#28 in #actix-web-middleware
13KB
69 lines
actix-delay
This crate provides a middleware of actix-web which simulates a delayed/slow response for testing purpose.
Usage
Add actix-delay
to dependencies
section in your project.
[dependencies]
actix-delay = "0.1"
Add actix_delay::middleware::Delay
as middleware.
use actix_delay::middleware::Delay;
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.wrap(Delay::new(3000))
.service(resource("/").to(|| async { "Hello!" }))
})
.bind("127.0.0.1:8080")?
.run()
.await
}
See full example.
Examples
- simple:
cargo run --example simple
License
Author
Yuki Kodama / @kuy
Dependencies
~28MB
~583K SLoC