f
This commit is contained in:
15
internal/domains/api/services/processors/response.go
Normal file
15
internal/domains/api/services/processors/response.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package processors
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// MarshalRawResponse 将上游原始响应数据序列化后返回(格式不符合预期时使用)。
|
||||
func MarshalRawResponse(data interface{}) ([]byte, error) {
|
||||
respBytes, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
return nil, errors.Join(ErrSystem, err)
|
||||
}
|
||||
return respBytes, nil
|
||||
}
|
||||
Reference in New Issue
Block a user