mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-23 13:10:19 +00:00
21 lines
490 B
Rust
21 lines
490 B
Rust
|
use super::*;
|
||
|
|
||
|
// ANCHOR: util2
|
||
|
#[salsa::query_group(Request)]
|
||
|
trait RequestUtil: RequestParser {
|
||
|
fn header(&self) -> Vec<ParsedHeader>;
|
||
|
fn content_type(&self) -> Option<String>;
|
||
|
}
|
||
|
|
||
|
fn header(db: &impl RequestUtil) -> Vec<ParsedHeader> {
|
||
|
db.parse().header.clone()
|
||
|
}
|
||
|
|
||
|
fn content_type(db: &impl RequestUtil) -> Option<String> {
|
||
|
db.header()
|
||
|
.iter()
|
||
|
.find(|header| header.key == "content-type")
|
||
|
.map(|header| header.value.clone())
|
||
|
}
|
||
|
// ANCHOR_END: util2
|