Skip to content

Commit ac206e8

Browse files
author
Arno Overgaauw
committed
Force mapstructure decoder tag to the json tag
1 parent 49dadde commit ac206e8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

eapi.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ func (handle *EapiReqHandle) Call() error {
251251
commands := handle.getAllCommands()
252252

253253
jsonrsp, err := handle.node.conn.Execute(commands, handle.encoding)
254+
254255
if err != nil {
255256
return err
256257
}
@@ -315,7 +316,13 @@ func (handle *EapiReqHandle) parseResponse(resp *JSONRPCResponse) error {
315316
if cmd.EapiCommand == nil {
316317
continue
317318
}
318-
err := mapstructure.Decode(result, cmd.EapiCommand)
319+
320+
d, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ TagName: "json", Result: cmd.EapiCommand })
321+
if err != nil {
322+
return err
323+
}
324+
325+
err = d.Decode(result)
319326
if err != nil {
320327
return err
321328
}

0 commit comments

Comments
 (0)