Handle quoted and hex string type HTTP args for both 'string' and '[]byte' type function args

This commit is contained in:
Matt Bell
2017-01-07 14:21:10 -08:00
parent af1212897c
commit 86506cd4f8
2 changed files with 44 additions and 31 deletions

View File

@@ -121,7 +121,7 @@ func (c *ClientURI) call(method string, params map[string]interface{}, result in
if err != nil {
return nil, err
}
log.Info(Fmt("URI request to %v (%v): %v", c.address, method, values))
// log.Info(Fmt("URI request to %v (%v): %v", c.address, method, values))
resp, err := c.client.PostForm(c.address+"/"+method, values)
if err != nil {
return nil, err
@@ -178,13 +178,6 @@ func argsToJson(args map[string]interface{}) error {
var n int
var err error
for k, v := range args {
// Convert strings to "0x"-prefixed hex
str, isString := reflect.ValueOf(v).Interface().(string)
if isString {
args[k] = fmt.Sprintf("0x%X", str)
continue
}
// Convert byte slices to "0x"-prefixed hex
byteSlice, isByteSlice := reflect.ValueOf(v).Interface().([]byte)
if isByteSlice {