actix-delay

Crates.ioactix-delay
lib.rsactix-delay
version0.1.0
sourcesrc
created_at2020-02-11 05:48:31.807083
updated_at2020-02-11 05:48:31.807083
descriptionSimulates a delayed response for actix-web
homepagehttps://github.com/kuy/actix-delay
repositoryhttps://github.com/kuy/actix-delay
max_upload_size
id207232
size42,803
Yuki Kodama (kuy)

documentation

https://docs.rs/actix-delay

README

actix-delay

crates.io build

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

MIT

Author

Yuki Kodama / @kuy

Commit count: 8

cargo fmt