from @marvin-j97 :
|
let meta = match parts |
|
.headers |
|
.get("xs-meta") |
|
.map(|x| x.to_str()) |
|
.transpose() |
|
.unwrap() |
|
.map(|s| serde_json::from_str(s).map_err(|_| format!("xs-meta isn't valid JSON: {}", s))) |
|
.transpose() |
|
{ |
|
Ok(meta) => meta, |
|
Err(e) => return response_400(e.to_string()), |
|
}; |
you could call serde_json::from_slice directly (if header value derefs to &[u8])
from @marvin-j97 :
xs/src/api.rs
Lines 225 to 236 in a387940
you could call serde_json::from_slice directly (if header value derefs to &[u8])