mirror of
https://github.com/salsa-rs/salsa.git
synced 2024-12-28 15:57:08 +00:00
17 lines
373 B
Rust
17 lines
373 B
Rust
|
use super::*;
|
||
|
|
||
|
// ANCHOR: util1
|
||
|
#[salsa::query_group(Request)]
|
||
|
trait RequestUtil: RequestParser {
|
||
|
fn content_type(&self) -> Option<String>;
|
||
|
}
|
||
|
|
||
|
fn content_type(db: &impl RequestUtil) -> Option<String> {
|
||
|
db.parse()
|
||
|
.header
|
||
|
.iter()
|
||
|
.find(|header| header.key == "content-type")
|
||
|
.map(|header| header.value.clone())
|
||
|
}
|
||
|
// ANCHOR_END: util1
|