mirror of
https://github.com/foomo/gotsrpc.git
synced 2025-10-16 12:35:35 +00:00
fix go scalar args conversion
This commit is contained in:
parent
68dc67cac1
commit
3be8701fd9
10
client.go
10
client.go
@ -11,7 +11,7 @@ import (
|
||||
// CallClient calls a method on the remove service
|
||||
func CallClient(url string, endpoint string, method string, args []interface{}, reply []interface{}) error {
|
||||
// Marshall args
|
||||
jsonArgs := make([]string, len(args))
|
||||
jsonArgs := []string{}
|
||||
for _, value := range args {
|
||||
jsonArg, err := json.Marshal(value)
|
||||
if err != nil {
|
||||
@ -29,15 +29,15 @@ func CallClient(url string, endpoint string, method string, args []interface{},
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
// Check status
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("Error: %s", resp.Status)
|
||||
}
|
||||
// Read in body
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Check status
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("%s: %s", resp.Status, string(body))
|
||||
}
|
||||
// Unmarshal reply
|
||||
if err := json.Unmarshal(body, &reply); err != nil {
|
||||
return err
|
||||
|
||||
3
go.go
3
go.go
@ -259,7 +259,8 @@ func renderServiceProxies(services map[string]*Service, fullPackageName string,
|
||||
|
||||
args = append(args, arg.Value.emptyLiteral(aliases))
|
||||
switch arg.Value.GoScalarType {
|
||||
case "int64":
|
||||
case "int", "int8", "int16", "int32", "int64",
|
||||
"uint", "uint8", "uint16", "uint32", "uint64":
|
||||
callArgs = append(callArgs, fmt.Sprint(arg.Value.GoScalarType+"(args[", skipArgI, "].(float64))"))
|
||||
default:
|
||||
// assert
|
||||
|
||||
Loading…
Reference in New Issue
Block a user