Skip to content

Commit

Permalink
fix/1012 fdp (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
MindHunter86 authored Sep 25, 2024
2 parents 0c8d4b0 + 3ff4954 commit 3118948
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
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.

0 comments on commit 3118948

Please sign in to comment.