master v1.0.13
李光春 2 years ago
parent c4331869fa
commit af5cd686ff

4
.gitignore vendored

@ -4,5 +4,5 @@
.idea
.vscode
*.log
gitmod.sh
*_test.go
*_test.go
gomod.sh

@ -15,7 +15,7 @@ import (
"time"
)
const Version = "1.0.12"
const Version = "1.0.13"
// Response 返回内容
type Response struct {
@ -32,6 +32,7 @@ type Response struct {
ResponseTime time.Time //【返回】时间
}
// App 实例
type App struct {
Uri string // 全局请求地址没有设置url才会使用
Error error // 错误
@ -45,6 +46,7 @@ type App struct {
p12Cert *tls.Certificate // p12证书内容
}
// 定义
var (
httpParamsModeJson = "JSON"
httpParamsModeXml = "XML"
@ -132,6 +134,7 @@ func (app *App) SetParams(params Params) {
}
}
// SetP12Cert 设置证书
func (app *App) SetP12Cert(content *tls.Certificate) {
app.p12Cert = content
}

@ -2,8 +2,10 @@ package gorequest
import (
"net/url"
"strings"
)
// ResponseUrlParse 返回参数
type ResponseUrlParse struct {
Uri string `json:"uri"` // URI
Urn string `json:"urn"` // URN
@ -35,3 +37,11 @@ func UriParse(input string) (resp ResponseUrlParse) {
resp.Fragment = parse.Fragment
return
}
// UriFilterExcludeQueryString 过滤掉url中的参数
func UriFilterExcludeQueryString(uri string) string {
URL, _ := url.Parse(uri)
clearUri := strings.ReplaceAll(uri, URL.RawQuery, "")
clearUri = strings.TrimRight(clearUri, "?")
return strings.TrimRight(clearUri, "/")
}

Loading…
Cancel
Save