Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d849412c
authored
Aug 15, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: replace json.Marshal and json.Unmarshal with common.Marshal and common.Unmarshal
parent
712865f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
relay/responses_handler.go
+3
-4
No files found.
relay/responses_handler.go
View file @
d849412c
...
...
@@ -2,7 +2,6 @@ package relay
import
(
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
...
...
@@ -48,21 +47,21 @@ func ResponsesHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *
if
err
!=
nil
{
return
types
.
NewError
(
err
,
types
.
ErrorCodeConvertRequestFailed
,
types
.
ErrOptionWithSkipRetry
())
}
jsonData
,
err
:=
js
on
.
Marshal
(
convertedRequest
)
jsonData
,
err
:=
comm
on
.
Marshal
(
convertedRequest
)
if
err
!=
nil
{
return
types
.
NewError
(
err
,
types
.
ErrorCodeConvertRequestFailed
,
types
.
ErrOptionWithSkipRetry
())
}
// apply param override
if
len
(
info
.
ParamOverride
)
>
0
{
reqMap
:=
make
(
map
[
string
]
interface
{})
err
=
js
on
.
Unmarshal
(
jsonData
,
&
reqMap
)
err
=
comm
on
.
Unmarshal
(
jsonData
,
&
reqMap
)
if
err
!=
nil
{
return
types
.
NewError
(
err
,
types
.
ErrorCodeChannelParamOverrideInvalid
,
types
.
ErrOptionWithSkipRetry
())
}
for
key
,
value
:=
range
info
.
ParamOverride
{
reqMap
[
key
]
=
value
}
jsonData
,
err
=
js
on
.
Marshal
(
reqMap
)
jsonData
,
err
=
comm
on
.
Marshal
(
reqMap
)
if
err
!=
nil
{
return
types
.
NewError
(
err
,
types
.
ErrorCodeConvertRequestFailed
,
types
.
ErrOptionWithSkipRetry
())
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment