| 332 | } |
| 333 | |
| 334 | static bool ProtoMessageToProtoJson(const google::protobuf::Message& message, |
| 335 | butil::IOBufAsZeroCopyOutputStream* wrapper, |
| 336 | Controller* cntl, int error_code) { |
| 337 | json2pb::Pb2ProtoJsonOptions options; |
| 338 | AlwaysPrintPrimitiveFields(options) = cntl->has_always_print_primitive_fields(); |
| 339 | options.always_print_enums_as_ints = FLAGS_pb_enum_as_number; |
| 340 | std::string error; |
| 341 | bool ok = json2pb::ProtoMessageToProtoJson(message, wrapper, options, &error); |
| 342 | if (!ok) { |
| 343 | cntl->SetFailed(error_code, "Fail to convert %s to proto-json: %s", |
| 344 | butil::EnsureString(message.GetDescriptor()->full_name()).c_str(), error.c_str()); |
| 345 | } |
| 346 | return ok; |
| 347 | } |
| 348 | |
| 349 | void ProcessHttpResponse(InputMessageBase* msg) { |
| 350 | const int64_t start_parse_us = butil::cpuwide_time_us(); |
no test coverage detected