MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / json_roundtrip

Function json_roundtrip

nodedb/src/control/server/native/codec.rs:137–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

135
136 #[test]
137 fn json_roundtrip() {
138 let req = NativeRequest {
139 op: OpCode::Ping,
140 seq: 1,
141 fields: RequestFields::Text(TextFields::default()),
142 };
143 let json = sonic_rs::to_vec(&req).unwrap();
144 assert_eq!(FrameFormat::detect(json[0]), FrameFormat::Json);
145
146 let decoded = decode_request(&json, FrameFormat::Json).unwrap();
147 assert_eq!(decoded.op, OpCode::Ping);
148 assert_eq!(decoded.seq, 1);
149 }
150
151 #[test]
152 fn msgpack_roundtrip() {

Callers

nothing calls this directly

Calls 1

decode_requestFunction · 0.70

Tested by

no test coverage detected