代码拉取完成,页面将自动刷新
同步操作将从 傅小黑/GoInk 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package hxgo
import (
"net/http"
"path"
"strings"
"mime/multipart"
)
// request object
type Request struct {
Raw *http.Request
Param []string
Url string
Method string
Host string
Uri string
RemoteAddr string
TLS bool
Ip string
UserAgent string
Refer string
Suffix string
}
// init request, fill properties
func (this *Request) init() {
this.Url = this.Raw.URL.Path
this.Method = this.Raw.Method
this.Host = this.Raw.URL.Host
this.Uri = this.Raw.RequestURI
this.RemoteAddr = this.Raw.RemoteAddr
this.TLS = this.Raw.TLS == nil
this.Ip = strings.Split(this.Raw.RemoteAddr, ":")[0]
this.UserAgent = this.Raw.UserAgent()
this.Refer = this.Raw.Referer()
this.Suffix = path.Ext(this.Url)
}
// get request header
func (this *Request) Header(key string) string {
return this.Raw.Header.Get(key)
}
// get request cookie value
func (this *Request) Cookie(name string) string {
c, e := this.Raw.Cookie(name)
if e != nil {
return ""
}
return c.Value
}
// check isAjax request
func (this *Request) IsAjax() bool {
return this.Header("X-Requested-With") == "XMLHttpRequest"
}
// get uploaded file by key string
func (this *Request) File(key string) (multipart.File, *multipart.FileHeader, error) {
this.Raw.ParseMultipartForm(32<<20)
return this.Raw.FormFile(key)
}
// create new request object
func NewRequested(r *http.Request) *Request {
req := &Request{Raw:r}
req.init()
return req
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。