mirror of
https://github.com/actix/actix-website
synced 2024-12-18 18:03:12 +01:00
15 lines
379 B
Rust
15 lines
379 B
Rust
|
// <example>
|
||
|
use actix_web::{http, HttpRequest, HttpResponse};
|
||
|
|
||
|
async fn index(req: HttpRequest) -> HttpResponse {
|
||
|
HttpResponse::Ok()
|
||
|
.connection_type(http::ConnectionType::Close) // <- Close connection
|
||
|
.force_close() // <- Alternative method
|
||
|
.finish()
|
||
|
}
|
||
|
// </example>
|
||
|
|
||
|
// ConnectionType::Close
|
||
|
// ConnectionType::KeepAlive
|
||
|
// ConnectionType::Upgrade
|