From 363c5a7da60375e4539f158f72f76979a7ddceee Mon Sep 17 00:00:00 2001 From: motian <405093691@qq.com> Date: Tue, 31 Dec 2024 22:48:31 +0800 Subject: [PATCH 1/3] fix(kernel): call Server.Serve nil pointer fixed --- src/kernel/serverGuard.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kernel/serverGuard.go b/src/kernel/serverGuard.go index e0a5088c..542ed51c 100644 --- a/src/kernel/serverGuard.go +++ b/src/kernel/serverGuard.go @@ -142,7 +142,9 @@ func (serverGuard *ServerGuard) Serve(request *http.Request) (response *http.Res response, err = validatedGuard.Resolve(request) - logger.Info("Server response created:", "content", response.ContentLength) + if response != nil { + logger.Info("Server response created:", "content", response.ContentLength) + } return response, err } @@ -450,7 +452,7 @@ func (serverGuard *ServerGuard) ParseMessage(content string, dataType string) (c callback = &models.Callback{} if len(content) <= 0 { - return nil, errors.New("request body is empty") + return callback, nil } if dataType == messages.DataTypeXML { From 107c13478200a344517ed88343a45a09c4b7b972 Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Wed, 1 Jan 2025 16:40:53 +0800 Subject: [PATCH 2/3] Revert "fix(kernel): call Server.Serve nil pointer fixed" --- src/kernel/serverGuard.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/kernel/serverGuard.go b/src/kernel/serverGuard.go index bd60a211..4e81a63d 100644 --- a/src/kernel/serverGuard.go +++ b/src/kernel/serverGuard.go @@ -139,9 +139,7 @@ func (serverGuard *ServerGuard) Serve(request *http.Request) (response *http.Res response, err = validatedGuard.Resolve(request) - if response != nil { - logger.Info("Server response created:", "content", response.ContentLength) - } + logger.Info("Server response created:", "content", response.ContentLength) return response, err } @@ -436,7 +434,7 @@ func (serverGuard *ServerGuard) ParseMessage(content string, dataType string) (c callback = &models.Callback{} if len(content) <= 0 { - return callback, nil + return nil, errors.New("request body is empty") } if dataType == messages.DataTypeXML { From 02a5182b9dae29aec77e168ef494168c19924313 Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Tue, 7 Jan 2025 09:07:56 +0800 Subject: [PATCH 3/3] update(work): ResponseAddMomentTask JobId int to string --- .../externalContact/moment/response/responseAddMomentTask.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/work/externalContact/moment/response/responseAddMomentTask.go b/src/work/externalContact/moment/response/responseAddMomentTask.go index b4b11d86..ce6b395e 100644 --- a/src/work/externalContact/moment/response/responseAddMomentTask.go +++ b/src/work/externalContact/moment/response/responseAddMomentTask.go @@ -20,5 +20,5 @@ type Result struct { type ResponseAddMomentTask struct { response.ResponseWork - JobId int `json:"jobid"` + JobId string `json:"jobid"` }