You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "mengccmumu (via GitHub)" <gi...@apache.org> on 2023/06/19 14:39:04 UTC
[GitHub] [dubbo-go-pixiu] mengccmumu commented on issue #569: 对于map[string]interface{}类型数据,pi xiu返回200,body却为空
mengccmumu commented on issue #569:
URL: https://github.com/apache/dubbo-go-pixiu/issues/569#issuecomment-1597307900
> 可否提供一个provider的最小demo
```
package TbConfig
import (
"dubbo.apache.org/dubbo-go/v3/config"
hessian "github.com/apache/dubbo-go-hessian2"
)
//
func NewBuild() *TbConfig {
return &TbConfig{}
}
//
func init() {
config.SetProviderService(&TbConfig{})
hessian.RegisterPOJO(&TbConfigRequest{})
hessian.RegisterPOJO(&ConfigResponse{})
}
type TbConfig struct {
}
type AResponse struct {
Code int32 `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
type TbConfigRequest struct {
paramsV int
}
type TbConfigResponse struct {
Count int
SMap []map[string]interface{}
}
func (*TbConfig) GetName() string {
return "TbConfig"
}
func (*TbConfig) GetInterface() string {
return "dubbo.golang.a.api.TbConfig"
}
// Get
func (*TbConfig) Get(ctx context.Context, request *TbConfigRequest) (*AResponse, error) {
response := &AResponse{}
if paramsV == 1 {
response.Code = 1
response.Msg = "failed"
return response, nil
}
respjson := `
{
"name" : "test",
"values" : [
{
"a" : 1,
"b" : 2
},
{
"a" : 3,
"b" : 4
},
]
}
`
resp := make(map[string]interface{})
_ = json.Unmarshal([]byte(respjson), &resp)
response.Data = resp
return response, nil
}
func (TbConfigRequest) JavaClassName() string {
return "dubbo.golang.a.b.c.TbConfigRequest"
}
func (TbConfigResponse) JavaClassName() string {
return "dubbo.golang.a.b.c.TbConfigResponse"
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org