Skip to content

Commit

Permalink
修复初始化client空指针异常
Browse files Browse the repository at this point in the history
  • Loading branch information
duanxingyu committed Sep 29, 2021
1 parent c0b0378 commit 71f320c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ func NewClient(client *http.Client) *HttpClient {
func NewClientX(client *http.Client,
beforeClientBuild, afterClientBuild, beforeRequestBuild, afterRequestBuild, afterResponseCreate AspectModel,
args ...interface{}) *HttpClient {
beforeRequestBuild(nil, nil, args)
if beforeRequestBuild != nil {
beforeRequestBuild(nil, nil, args)
}

hc := &HttpClient{
c: client,
Expand All @@ -136,8 +138,9 @@ func NewClientX(client *http.Client,
AfterResponseCreate: afterResponseCreate,
AspectArgs: args,
}

afterRequestBuild(nil, nil, args)
if afterRequestBuild != nil {
afterRequestBuild(nil, nil, args)
}

return hc
}

0 comments on commit 71f320c

Please sign in to comment.