master v1.0.3
李光春 2 years ago
parent dae2679126
commit 5a93437a1b

@ -98,6 +98,9 @@ func (app *App) SetContentTypeForm() {
// SetParam 设置请求参数
func (app *App) SetParam(key string, value interface{}) {
if key == "" {
panic("url is empty")
}
app.httpParams.Set(key, value)
}
@ -130,6 +133,14 @@ func (app *App) Request() (httpResponse Response, err error) {
// 请求
func request(app *App) (httpResponse Response, err error) {
// 判断网址
if app.httpUrl == "" {
app.httpUrl = app.Url
}
if app.httpUrl == "" {
return httpResponse, errors.New("没有设置Url")
}
// 创建 http 客户端
client := &http.Client{}

@ -6,7 +6,7 @@ import (
"strings"
)
const Version = "1.0.2"
const Version = "1.0.3"
// ClientIp 尽最大努力实现获取客户端 IP 的算法。
// 解析 X-Real-IP 和 X-Forwarded-For 以便于反向代理nginx 或 haproxy可以正常工作。

Loading…
Cancel
Save