MCPcopy Create free account
hub / github.com/apache/mesos / deserialize

Method deserialize

src/tests/scheduler_http_api_tests.cpp:88–101  ·  view source on GitHub ↗

TODO(anand): Use the serialize/deserialize from common/http.hpp when they are available.

Source from the content-addressed store, hash-verified

86 // TODO(anand): Use the serialize/deserialize from common/http.hpp
87 // when they are available.
88 Try<Event> deserialize(const string& contentType, const string& body)
89 {
90 if (contentType == APPLICATION_PROTOBUF) {
91 Event event;
92 if (!event.ParseFromString(body)) {
93 return Error("Failed to parse body into Event protobuf");
94 }
95 return event;
96 }
97
98 Try<JSON::Value> value = JSON::parse(body);
99 Try<Event> parse = ::protobuf::parse<Event>(value.get());
100 return parse;
101 }
102
103 string serialize(const Call& call, const string& contentType)
104 {

Callers 1

decodeMethod · 0.45

Calls 3

ErrorFunction · 0.50
parseFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected