pub trait InertiaRequest {
fn inertia_header(&self, name: &str) -> Option<&str>;
fn path(&self) -> &str;
fn is_inertia(&self) -> bool {
self.inertia_header("X-Inertia")
.map(|v| v == "true")
.unwrap_or(false)
}
fn inertia_version(&self) -> Option<&str> {
self.inertia_header("X-Inertia-Version")
}
fn inertia_partial_data(&self) -> Option<Vec<&str>> {
self.inertia_header("X-Inertia-Partial-Data")
.map(|v| v.split(',').map(str::trim).collect())
}
fn inertia_partial_component(&self) -> Option<&str> {
self.inertia_header("X-Inertia-Partial-Component")
}
fn accepts_json(&self) -> bool {
self.inertia_header("Accept")
.map(|v| v.contains("application/json"))
.unwrap_or(false)
}
}