From 71f320c18bf515e320e7196a39615e90bb1de016 Mon Sep 17 00:00:00 2001 From: duanxingyu Date: Thu, 30 Sep 2021 00:26:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9D=E5=A7=8B=E5=8C=96cl?= =?UTF-8?q?ient=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index deb937e..730bb07 100644 --- a/client.go +++ b/client.go @@ -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, @@ -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 }