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

14 lines
376 B
Rust
Raw Normal View History

2019-06-13 17:10:51 -04:00
// <example>
use actix_web::{http, HttpRequest, HttpResponse};
pub 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>
// ConnectionType::Close
// ConnectionType::KeepAlive
// ConnectionType::Upgrade