【问题标题】:How do you define a file response as a Message您如何将文件响应定义为消息
【发布时间】:2019-10-08 18:34:37
【问题描述】:

我正在使用proto 来定义一个 REST 服务

在我的服务中,我试图记录服务响应文件。

我已经浏览过这里https://github.com/protocolbuffers/protobuf/tree/master/src/google/protobuf,但找不到任何看起来像文件的东西。

service SomeService {
    rpc GetStaticAsset(GetMessageRequest) returns (FileAsset) {
        option (google.api.http) = {
            get: "/static/{assetName}"
        };
    }
}

message FileAsset {
    ¯\_(ツ)_/¯
}

【问题讨论】:

    标签: protocol-buffers proto proto3


    【解决方案1】:

    找到答案here:

    message Chunk {
        bytes Content = 1;
    }
    

    【讨论】:

      猜你喜欢
      • 2012-02-16
      • 2019-10-07
      • 1970-01-01
      • 2023-03-19
      • 1970-01-01
      • 2016-07-10
      • 2014-07-29
      • 2018-11-13
      • 1970-01-01
      相关资源
      最近更新 更多