Documentation
¶
Index ¶
- Constants
- Variables
- func ClientRequestHost(c *gin.Context) string
- func ClientRequestUrl(c *gin.Context) string
- func CloneHeader(c *gin.Context, header http.Header)
- func ExtractReqBody(c *gin.Context) ([]byte, error)
- func IsErrorCode(code int) bool
- func IsErrorResponse(c *gin.Context) bool
- func IsRedirectCode(code int) bool
- func IsSuccessCode(code int) bool
- func MapBody(body map[string]any) io.ReadCloser
- func ProxyRequest(c *gin.Context, remote string, withUri bool) error
- func Request(method, url string, header http.Header, body io.ReadCloser) (*http.Response, error)
- func RequestRedirect(method, url string, header http.Header, body io.ReadCloser, autoRedirect bool) (string, *http.Response, error)
Constants ¶
View Source
const (
// MaxRedirectDepth 重定向的最大深度
MaxRedirectDepth = 10
)
Variables ¶
View Source
var RedirectCodes = [4]int{http.StatusMovedPermanently, http.StatusFound, http.StatusTemporaryRedirect, http.StatusPermanentRedirect}
RedirectCodes 有重定向含义的 http 响应码
Functions ¶
func ClientRequestHost ¶
ClientRequestHost 获取客户端请求的 Host
func CloneHeader ¶
CloneHeader 克隆 http 头部到 gin 的响应头中
func ExtractReqBody ¶ added in v1.0.8
ExtractReqBody 克隆并提取请求体 不影响 c 对象之后再次读取请求体
func IsSuccessCode ¶ added in v1.5.1
IsSuccessCode 判断 http code 是否为成功状态
func ProxyRequest ¶
ProxyRequest 代理请求
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.