Documentation
¶
Index ¶
- 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 IsErrorResponse(c *gin.Context) bool
- func IsRedirectCode(code int) bool
- func MapBody(body map[string]interface{}) 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)
Constants ¶
This section is empty.
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 MapBody ¶
func MapBody(body map[string]interface{}) io.ReadCloser
MapBody 将 map 转换为 ReadCloser 流
func ProxyRequest ¶
ProxyRequest 代理请求
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.