MCPcopy Create free account
hub / github.com/acking-you/static_flow / current_page_path

Function current_page_path

crates/frontend/src/api.rs:158–174  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156
157#[cfg(not(feature = "mock"))]
158fn current_page_path() -> Option<String> {
159 let window = web_sys::window()?;
160 let location = window.location();
161 let mut path = location.pathname().ok().unwrap_or_else(|| "/".to_string());
162 if path.trim().is_empty() {
163 path = "/".to_string();
164 }
165 let search = location.search().ok().unwrap_or_default();
166 let hash = location.hash().ok().unwrap_or_default();
167 if !search.is_empty() {
168 path.push_str(&search);
169 }
170 if !hash.is_empty() {
171 path.push_str(&hash);
172 }
173 Some(path)
174}
175
176#[cfg(not(feature = "mock"))]
177fn with_behavior_headers(mut builder: RequestBuilder) -> RequestBuilder {

Callers 1

with_behavior_headersFunction · 0.85

Calls 3

okMethod · 0.80
trimMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected