如何将 http.Request 包装到 proto 文件中

How to wrap http.Request into proto file

我需要将 http.Request 包装到 proto 文件中,以便我可以从客户端向服务器端发送请求实例,如以下代码所示:

message WrapRequest{
  *http.Request request = 1; // this is wrong
  int64 start = 2;
  int64 stop = 3;
  bool match = 4;
  string ruleid = 5;
}

我确定我代码中的请求行是错误的,有没有人知道如何实现它。非常感谢。

您可以不传递 http.Request 而传递 http.Request.Bodyhttp.Request.Header 取决于您在服务器上使用什么。