| 105 | namespace internal { |
| 106 | |
| 107 | string serialize( |
| 108 | ContentType contentType, |
| 109 | const google::protobuf::Message& message) |
| 110 | { |
| 111 | switch (contentType) { |
| 112 | case ContentType::PROTOBUF: { |
| 113 | return message.SerializeAsString(); |
| 114 | } |
| 115 | case ContentType::JSON: { |
| 116 | return jsonify(JSON::Protobuf(message)); |
| 117 | } |
| 118 | case ContentType::RECORDIO: { |
| 119 | LOG(FATAL) << "Serializing a RecordIO stream is not supported"; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | UNREACHABLE(); |
| 124 | } |
| 125 | |
| 126 | |
| 127 | bool streamingMediaType(ContentType contentType) |