forked from TechEmpower/FrameworkBenchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest_middleware.rs
More file actions
30 lines (29 loc) · 771 Bytes
/
Copy pathrequest_middleware.rs
File metadata and controls
30 lines (29 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use super::*;
pub async fn request(ctx: Context) {
ctx.set_response_header(CONNECTION, CONNECTION_KEEP_ALIVE)
.await
.set_response_header(SERVER, HYPERLANE)
.await
.set_response_header(DATE, gmt())
.await;
#[cfg(feature = "plaintext")]
{
ctx.set_response_header(CONTENT_TYPE, TEXT_PLAIN).await;
}
#[cfg(feature = "fortunes")]
{
ctx.set_response_header(CONTENT_TYPE, content_type_charset(TEXT_HTML, UTF8))
.await;
}
#[cfg(any(
feature = "json",
feature = "db",
feature = "query",
feature = "update",
feature = "cached_query"
))]
{
ctx.set_response_header(CONTENT_TYPE, APPLICATION_JSON)
.await;
}
}