2019-09-24 10:08:30 +00:00
|
|
|
use super::*;
|
|
|
|
|
|
|
|
// ANCHOR: util2
|
|
|
|
#[salsa::query_group(Request)]
|
|
|
|
trait RequestUtil: RequestParser {
|
|
|
|
fn header(&self) -> Vec<ParsedHeader>;
|
|
|
|
fn content_type(&self) -> Option<String>;
|
|
|
|
}
|
|
|
|
|
2020-07-03 10:46:00 +00:00
|
|
|
fn header(db: &dyn RequestUtil) -> Vec<ParsedHeader> {
|
2019-09-24 10:08:30 +00:00
|
|
|
db.parse().header.clone()
|
|
|
|
}
|
|
|
|
|
2020-07-03 10:46:00 +00:00
|
|
|
fn content_type(db: &dyn RequestUtil) -> Option<String> {
|
2019-09-24 10:08:30 +00:00
|
|
|
db.header()
|
|
|
|
.iter()
|
|
|
|
.find(|header| header.key == "content-type")
|
|
|
|
.map(|header| header.value.clone())
|
|
|
|
}
|
|
|
|
// ANCHOR_END: util2
|