Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/1012 fdp #49

Merged
merged 5 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (*Proxy) unmarshalApiResponse(c *fiber.Ctx, rsp *fasthttp.Response) (ok boo
}
defer utils.ReleaseApiResponseWOData(apirsp)

if apirsp.Status && (apirsp.Error == nil || apirsp.Error.Code == 0) {
if apirsp.Status && (apirsp.Error == nil || apirsp.Error.Code == "0") {
ok = true
return
}
Expand All @@ -160,7 +160,7 @@ func (*Proxy) unmarshalApiResponse(c *fiber.Ctx, rsp *fasthttp.Response) (ok boo
rlog(c).Trace().Msgf("%+v", apirsp.Error)
}

rlog(c).Info().Msgf("api server respond with %d - %s", apirsp.Error.Code, apirsp.Error.Message)
rlog(c).Info().Msgf("api server respond with %s - %s", apirsp.Error.Code, apirsp.Error.Message)
return
}

Expand Down
7 changes: 4 additions & 3 deletions internal/utils/apiv1_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package utils

import (
"io"
"strconv"
"sync"

"github.com/mailru/easyjson"
Expand All @@ -22,7 +23,7 @@ type (
Code string
}
ApiError struct {
Code int
Code string
Message string
Description string
}
Expand All @@ -42,7 +43,7 @@ func AcquireApiResponseWOData() *ApiResponseWOData {

func ReleaseApiResponseWOData(ar *ApiResponseWOData) {
ar.Status = false
ar.Error.Code, ar.Error.Message, ar.Error.Description = 0, "", ""
ar.Error.Code, ar.Error.Message, ar.Error.Description = "", "", ""
apiResponseWODataPool.Put(ar)
}

Expand Down Expand Up @@ -72,7 +73,7 @@ func RespondWithApiError(status int, msg, desc string, w io.Writer) (e error) {
defer ReleaseApiResponse(apirsp)

apirsp.Error.Code, apirsp.Error.Message, apirsp.Error.Description =
status, msg, desc
strconv.Itoa(status), msg, desc
apirsp.Data = nil

var buf []byte
Expand Down
4 changes: 2 additions & 2 deletions internal/utils/apiv1_response_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading