Skip to content

runtime.WithForwardResponseOption compile error  #1607

Closed
@zhangjie2012

Description

@zhangjie2012

🐛 Bug Report

use runtime.NewServeMux with runtime.WithForwardResponseOption compile throw:

cannot use myFilter (type func(context.Context, http.ResponseWriter, protoreflect.ProtoMessage) error) as type func(context.Context, http.ResponseWriter, protoiface.MessageV1) error in argument to "github.com/grpc-ecosystem/grpc-gateway/runtime".WithForwardResponseOption

source code:

func myFilter(ctx context.Context, w http.ResponseWriter, resp proto.Message) error {
    return nil
}
    gwMux := runtime.NewServeMux(
        // runtime.WithIncomingHeaderMatcher(func(key string) (string, bool) {
        //  return key, true
        // }),
        // runtime.WithOutgoingHeaderMatcher(func(key string) (string, bool) {
        //  return key, true
        // }),
        runtime.WithForwardResponseOption(myFilter),
    )

Environment

  • github.com/grpc-ecosystem/grpc-gateway v1.14.7
  • go version go1.14.7 darwin/amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions