Documentation ¶
Index ¶
- func IsMarked(header http.Header) bool
- func IsNegligibleError(err error) booldeprecated
- func IsProxyDialError(err error) booldeprecated
- func Proxy(w http.ResponseWriter, r *http.Request, host string, options ...ProxyOption) errordeprecated
- func ProxyToUrl(w http.ResponseWriter, r *http.Request, targetUrl *url.URL) (err error)deprecated
- func ProxyWithGin(ctx *gin.Context, host string, options ...ProxyOption) errordeprecated
- type ProxyOption
- func WithErrorLogger(errorLogger *log.Logger) ProxyOption
- func WithExtraQueryParams(extraQueryParams map[string][]string) ProxyOption
- func WithModifyResponse(modifyResponse func(*http.Response) error) ProxyOption
- func WithOverrideQueryParams(overrideQueryParams map[string][]string) ProxyOption
- func WithPolyfillHeaders(polyfillHeaders bool) ProxyOption
- func WithRequestUrlPath(requestUrlPath *string) ProxyOption
- func WithScheme(scheme string) ProxyOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNegligibleError
deprecated
func IsProxyDialError
deprecated
func Proxy
deprecated
func Proxy(w http.ResponseWriter, r *http.Request, host string, options ...ProxyOption) error
Proxy 代理请求(反向代理,请求转发).
Deprecated: Use forwardKit instead.
调用此方法就行请求转发前,按照实际场景可以: (1) POST请求,覆盖 request body; (2) 变更请求头(request header).
@param w e.g.ctx.Writer @param r e.g.ctx.Request @param host e.g."127.0.0.1:12345" @param options optional
func ProxyToUrl
deprecated
func ProxyWithGin
deprecated
func ProxyWithGin(ctx *gin.Context, host string, options ...ProxyOption) error
ProxyWithGin
Deprecated: Use forwardKit instead.
Types ¶
type ProxyOption ¶
type ProxyOption func(opts *proxyOptions)
func WithErrorLogger ¶
func WithErrorLogger(errorLogger *log.Logger) ProxyOption
func WithExtraQueryParams ¶
func WithExtraQueryParams(extraQueryParams map[string][]string) ProxyOption
WithExtraQueryParams
PS: (1) WithOverrideQueryParams 和 WithExtraQueryParams 只能二选一. (2) 值不用进行编码处理.
func WithModifyResponse ¶
func WithModifyResponse(modifyResponse func(*http.Response) error) ProxyOption
func WithOverrideQueryParams ¶
func WithOverrideQueryParams(overrideQueryParams map[string][]string) ProxyOption
WithOverrideQueryParams
PS: (1) WithOverrideQueryParams 和 WithExtraQueryParams 只能二选一. (2) 值不用进行编码处理.
func WithPolyfillHeaders ¶
func WithPolyfillHeaders(polyfillHeaders bool) ProxyOption
func WithRequestUrlPath ¶
func WithRequestUrlPath(requestUrlPath *string) ProxyOption
WithRequestUrlPath
PS: 如果 当前路由 和 目标路由 一致,可以不配置此项;否则必须配置.
@param requestUrlPath (1) 不带query;
(2) 可以使用 ptrKit.Of() 生成 *string 实例.
func WithScheme ¶
func WithScheme(scheme string) ProxyOption
Click to show internal directories.
Click to hide internal directories.