Skip to content

performance: deserialize meta in api::append #41

@cablehead

Description

@cablehead

from @marvin-j97 :

xs/src/api.rs

Lines 225 to 236 in a387940

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])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions