divan/gorilla-xmlrpc

DecodeClientResponse fails to parse empty strings

jamesfcarter opened this issue · 1 comments

package main

import (
	"bytes"
	"fmt"
	"github.com/divan/gorilla-xmlrpc/xml"
)

func main() {
	var response struct {
		Result string
	}
	responseXML := []byte("<methodResponse><params><param><value><string></string></value></param></params></methodResponse>")
	err := xml.DecodeClientResponse(bytes.NewBuffer(responseXML), &response)
	if err != nil {
		fmt.Print(err)
	} else {
		fmt.Printf("%s\n", response.Result)
	}
}

I would expect the above to output a blank line but instead it outputs:

<string></string>
divan commented

Fixed in 854ddee