Commit c6181ce6 authored by wangyao02's avatar wangyao02

-Add cntl->set_pb_jsonify_empty_array(bool). Convert the repeated field that has…

-Add cntl->set_pb_jsonify_empty_array(bool). Convert the repeated field that has no entry to a empty array of json in HTTP response.
-Change log level in StreamWrite from FATAL to Warning when call
-StreamWrite after socket closed
-Fix attachment forward for baidu-rpc combination calls
-Fix hulurpc user data/attachment forward; Fix parallel request attachment forward
-Return Error if parse JsonString failed
parent d7edf05a
......@@ -402,13 +402,13 @@ bool JsonValueToProtoMessage(const BUTIL_RAPIDJSON_NAMESPACE::Value& json_value,
google::protobuf::Message* message,
const Json2PbOptions& options,
std::string* err) {
const google::protobuf::Descriptor* descriptor = message->GetDescriptor();
if (!json_value.IsObject()) {
J2PERROR(err, "`json_value' is not a json object");
J2PERROR(err, "`json_value' is not a json object. %s", descriptor->name().c_str());
return false;
}
const google::protobuf::Reflection* reflection = message->GetReflection();
const google::protobuf::Descriptor* descriptor = message->GetDescriptor();
std::vector<const google::protobuf::FieldDescriptor*> fields;
fields.reserve(64);
......@@ -491,6 +491,10 @@ inline bool JsonToProtoMessageInline(const std::string& json_string,
}
BUTIL_RAPIDJSON_NAMESPACE::Document d;
d.Parse<0>(json_string.c_str());
if (d.HasParseError()) {
J2PERROR(error, "Invalid json format");
return false;
}
return json2pb::JsonValueToProtoMessage(d, message, options, error);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment