Skip to content

Commit

Permalink
调整:增加默认读取Proxy配置
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Jun 27, 2024
1 parent 434e59e commit 2a818c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion http/httpRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package http
import (
"crypto/tls"
"encoding/json"
"github.com/farseer-go/fs/configure"
"github.com/farseer-go/fs/container"
"github.com/farseer-go/fs/core"
"github.com/farseer-go/fs/parse"
Expand All @@ -17,10 +18,14 @@ import (

// 支持请求超时设置,单位:ms
func httpRequest(methodName string, requestUrl string, head map[string]any, body any, contentType string, requestTimeout int) (string, int, error) {
rspBody, statusCode, _, err := RequestProxy(methodName, requestUrl, head, body, contentType, requestTimeout, "")
rspBody, statusCode, _, err := RequestProxy(methodName, requestUrl, head, body, contentType, requestTimeout, configure.GetString("Proxy"))
return rspBody, statusCode, err
}

func RequestProxyConfigure(methodName string, requestUrl string, head map[string]any, body any, contentType string, requestTimeout int) (string, int, map[string]string, error) {
return RequestProxy(methodName, requestUrl, head, body, contentType, requestTimeout, configure.GetString("Proxy"))
}

// RequestProxy 支持请求超时设置,单位:ms
func RequestProxy(methodName string, requestUrl string, head map[string]any, body any, contentType string, requestTimeout int, proxyAddr string) (string, int, map[string]string, error) {
traceDetailHttp := container.Resolve[trace.IManager]().TraceHttp(methodName, requestUrl)
Expand Down

0 comments on commit 2a818c2

Please sign in to comment.