mirror of
https://github.com/maplibre/martin.git
synced 2024-12-20 05:11:57 +03:00
fix: function source query params parse
This commit is contained in:
parent
73d8e86860
commit
8ac2812d05
@ -16,7 +16,8 @@ pub fn build_tilejson(
|
||||
) -> Result<TileJSON, ToStrError> {
|
||||
let source_id = source.get_id();
|
||||
|
||||
let path = headers
|
||||
let path =
|
||||
headers
|
||||
.get("x-rewrite-url")
|
||||
.map_or(Ok(path.trim_right_matches(".json")), |header| {
|
||||
let header_str = header.to_str()?;
|
||||
@ -99,7 +100,9 @@ pub fn json_to_hashmap(value: &serde_json::Value) -> HashMap<String, String> {
|
||||
pub fn query_to_json_string(query: &Query) -> Result<String, serde_json::Error> {
|
||||
let mut query_as_json = HashMap::new();
|
||||
for (k, v) in query.iter() {
|
||||
let json_value: serde_json::Value = serde_json::from_str(v)?;
|
||||
let json_value: serde_json::Value =
|
||||
serde_json::from_str(v).unwrap_or_else(|_| serde_json::Value::String(v.clone()));
|
||||
|
||||
query_as_json.insert(k, json_value);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user