MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / post_response

Function post_response

examples/axum_example/api/src/flash.rs:34–51  ·  view source on GitHub ↗
(cookies: &mut Cookies, data: T)

Source from the content-addressed store, hash-verified

32pub type PostResponse = (StatusCode, HeaderMap);
33
34pub fn post_response<T>(cookies: &mut Cookies, data: T) -> PostResponse
35where
36 T: Serialize,
37{
38 let valued_message_ref = ValuedMessageRef { value: &data };
39
40 let mut cookie = Cookie::new(
41 FLASH_COOKIE_NAME,
42 serde_json::to_string(&valued_message_ref).unwrap(),
43 );
44 cookie.set_path("/");
45 cookies.add(cookie);
46
47 let mut header = HeaderMap::new();
48 header.insert(header::LOCATION, HeaderValue::from_static("/"));
49
50 (StatusCode::SEE_OTHER, header)
51}

Callers 3

create_postFunction · 0.85
update_postFunction · 0.85
delete_postFunction · 0.85

Calls 4

unwrapMethod · 0.80
addMethod · 0.80
newFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected