package gateway import ( "git.sxidc.com/go-framework/baize/framework/binding" "git.sxidc.com/go-framework/baize/framework/binding/request" "git.sxidc.com/go-framework/baize/framework/binding/response" "git.sxidc.com/go-framework/baize/framework/core/api" "git.sxidc.com/go-framework/baize/framework/core/domain" "git.sxidc.com/go-framework/baize/framework/core/infrastructure" "net/http" ) type PassThrough struct { HttpMethod string RelativePath string ToUrl string } func (gw *Gateway) BindPassThrough(binder *binding.Binder, passThrough *PassThrough, middlewares ...api.Handler) { binding.Bind[any](binder, &binding.BindItem[any]{ Method: passThrough.HttpMethod, SimpleBindItem: &binding.SimpleBindItem[any]{ Path: passThrough.RelativePath, ResponseFunc: response.NoResponse, ServiceFunc: func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (any, error) { c.Redirect(http.StatusTemporaryRedirect, passThrough.ToUrl) return nil, nil }, }, }, middlewares...) }