Browse Source

update dtmdriver-http

pull/267/head
yedf2 4 years ago
parent
commit
c93afa3972
  1. 3
      dtmcli/dtmimp/vars.go
  2. 2
      dtmsvr/trans_status.go
  3. 4
      go.mod
  4. 2
      go.sum

3
dtmcli/dtmimp/vars.go

@ -46,9 +46,8 @@ func init() {
RestyClient.OnBeforeRequest(func(c *resty.Client, r *resty.Request) error {
r.URL = MayReplaceLocalhost(r.URL)
u, err := dtmdriver.GetHTTPDriver().ResolveURL(r.URL)
logger.Debugf("requesting: %s %s %s", r.Method, r.URL, MustMarshalString(r.Body))
logger.Debugf("requesting: %s %s %s resolved: %s", r.Method, r.URL, MustMarshalString(r.Body), u)
r.URL = u
logger.Debugf("resolved: %s err: %v", r.URL, err)
return err
})
RestyClient.OnAfterResponse(func(c *resty.Client, resp *resty.Response) error {

2
dtmsvr/trans_status.go

@ -89,7 +89,7 @@ func (t *TransGlobal) getURLResult(uri string, branchID, op string, branchPayloa
if uri == "" { // empty url is success
return nil
}
if strings.HasPrefix(uri, "http://") || strings.HasPrefix(uri, "https://") {
if t.Protocol == "http" || strings.HasPrefix(uri, "http://") || strings.HasPrefix(uri, "https://") {
if t.RequestTimeout != 0 {
dtmimp.RestyClient.SetTimeout(time.Duration(t.RequestTimeout) * time.Second)
}

4
go.mod

@ -7,7 +7,7 @@ require (
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/dtm-labs/dtmdriver v0.0.3
github.com/dtm-labs/dtmdriver-gozero v0.0.2
github.com/dtm-labs/dtmdriver-http v1.2.0
github.com/dtm-labs/dtmdriver-http v1.2.2
github.com/dtm-labs/dtmdriver-kratos v0.0.4
github.com/dtm-labs/dtmdriver-polaris v0.0.4
github.com/dtm-labs/dtmdriver-protocol1 v0.0.1
@ -38,4 +38,4 @@ require (
// replace github.com/dtm-labs/dtmdriver v0.0.2 => /Users/wangxi/dtm/dtmdriver
// replace github.com/horseLk/dtmdriver-nacos v1.1.0 => /Users/wangxi/dtm/dtmdriver-http-nacos
// replace github.com/dtm-labs/dtmdriver-http => /Users/wangxi/dtm/dtmdriver-http-nacos

2
go.sum

@ -121,6 +121,8 @@ github.com/dtm-labs/dtmdriver-gozero v0.0.2 h1:T+JH9kwVNMmISPU1BNviiTrvPdMA7UMFD
github.com/dtm-labs/dtmdriver-gozero v0.0.2/go.mod h1:5AAKwYok5f56e0kATOXvc+DAsfu4elISDuCV+G3+fYE=
github.com/dtm-labs/dtmdriver-http v1.2.0 h1:9v1od77rSrJUuiBnZ/o6Ic4jRJpToxjP2nUOnx9CIas=
github.com/dtm-labs/dtmdriver-http v1.2.0/go.mod h1:UtWShS61TiiudZUAabQ2ww0CzSEpBYF3AS3F3G2Jc2o=
github.com/dtm-labs/dtmdriver-http v1.2.2 h1:QOul+PpK1KQyXXx5viNrHrEFIc/nFxmX4fJfI3DLUqI=
github.com/dtm-labs/dtmdriver-http v1.2.2/go.mod h1:UtWShS61TiiudZUAabQ2ww0CzSEpBYF3AS3F3G2Jc2o=
github.com/dtm-labs/dtmdriver-kratos v0.0.4 h1:jDVvrwiw8GwVrampIxhoXZ9TewwQKHFpcDcQXyU2Qyc=
github.com/dtm-labs/dtmdriver-kratos v0.0.4/go.mod h1:MjrFIa2A191ATVb/xy2vnA2ZKqMK9zC/1m3pjxXwkac=
github.com/dtm-labs/dtmdriver-polaris v0.0.4 h1:yli0YmAsEgl47ymJHTxIzULeNe5dnmfN2ixLJRWm2Ok=

Loading…
Cancel
Save