| 134 | } |
| 135 | |
| 136 | func (s *Server) forwardResponseOption() func(ctx context.Context, w http.ResponseWriter, msg proto.Message) error { |
| 137 | return func(ctx context.Context, w http.ResponseWriter, msg proto.Message) error { |
| 138 | md, ok := runtime.ServerMetadataFromContext(ctx) |
| 139 | if !ok { |
| 140 | return nil |
| 141 | } |
| 142 | |
| 143 | // Set cookies |
| 144 | cookies := md.HeaderMD.Get("x-http-set-cookie") |
| 145 | if len(cookies) > 0 { |
| 146 | for _, cookie := range cookies { |
| 147 | w.Header().Add("Set-Cookie", cookie) |
| 148 | } |
| 149 | delete(md.HeaderMD, "x-http-set-cookie") |
| 150 | delete(w.Header(), "Grpc-Metadata-X-Http-Set-Cookie") |
| 151 | } |
| 152 | |
| 153 | return nil |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | func (s *Server) errorHandler() func(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, r *http.Request, err error) { |
| 158 | return func(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, r *http.Request, reqError error) { |