1
0
mirror of https://github.com/actix/actix-website synced 2025-02-02 12:19:04 +01:00
actix-website/examples/server/src/keep_alive_tp.rs

15 lines
379 B
Rust
Raw Normal View History

2019-06-13 17:10:51 -04:00
// <example>
use actix_web::{http, HttpRequest, HttpResponse};
2019-12-29 03:32:56 +09:00
async fn index(req: HttpRequest) -> HttpResponse {
2019-06-13 17:10:51 -04:00
HttpResponse::Ok()
.connection_type(http::ConnectionType::Close) // <- Close connection
.force_close() // <- Alternative method
.finish()
}
// </example>
2020-09-12 16:21:54 +01:00
// ConnectionType::Close
// ConnectionType::KeepAlive
// ConnectionType::Upgrade