-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streaming proto can not generate http code #1958
Comments
HTTP definitions cannot be used in streaming |
So how to use http streaming in kratos? |
Not for the time being |
How to use middleware for this custom HTTP interface? opts := []http.ServerOption{
http.Middleware(
ratelimit.Server(),
middleware.Recovery(logger),
tracing.Server(),
middleware.Server(logger),
validate.Validator(),
),
}
srv := http.NewServer(opts...)
srv.Route("/").POST("/api/util/other/zip", func(ctx http.Context) error {
var req v1.CreateZipRequest
if err := ctx.Bind(&req); err != nil {
return err
}
err := us.uc.CreateZipHttp(context.Background(), &req, ctx.Response())
if err != nil {
return err
}
return nil
}) and i use ctx.Response() as streaming io.Writer get this error: |
You can refer to the usage in the |
me too,kratos can‘t’ generate stream code in xxx_http.pb.go, 什么时候可以支持kratos生成stream的http客户端呢? |
Hi, @hoslo! I'm Dosu, and I'm helping the kratos team manage their backlog. I wanted to let you know that we are marking this issue as stale. From what I understand, you were experiencing an issue with the streaming proto not generating the expected HTTP code in Kratos version 2.2.0. It was mentioned that HTTP definitions cannot be used in streaming, and you asked how to use middleware for a custom HTTP interface. Another user suggested referring to the usage in the Based on the resolution, it seems that the issue has been resolved. You were informed that HTTP definitions cannot be used in streaming in Kratos, and you were advised to refer to the usage in the Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the kratos repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you for your understanding and contribution to the kratos repository! |
What happened:
Streaming proto can not generate http code
What you expected to happen:
generate http code
How to reproduce it (as minimally and precisely as possible):
rpc CreateZip (CreateZipRequest) returns (stream CreateZipReply) {
option (google.api.http) = {
post: "/api/util/other/zip",
body: "*"
};
}
Anything else we need to know?:
Environment:
kratos -v
): v2.2.0go version
): go version go1.18 windows/amd64cat /etc/os-release
): centos7The text was updated successfully, but these errors were encountered: