Switch to dep for dependency management

This commit is contained in:
Dan Sosedoff
2018-08-31 21:49:24 -05:00
parent 847f47c5d3
commit ad81f666a5
537 changed files with 167100 additions and 34410 deletions

View File

@@ -5,7 +5,9 @@
package binding
import (
"bytes"
"encoding/xml"
"io"
"net/http"
)
@@ -16,7 +18,14 @@ func (xmlBinding) Name() string {
}
func (xmlBinding) Bind(req *http.Request, obj interface{}) error {
decoder := xml.NewDecoder(req.Body)
return decodeXML(req.Body, obj)
}
func (xmlBinding) BindBody(body []byte, obj interface{}) error {
return decodeXML(bytes.NewReader(body), obj)
}
func decodeXML(r io.Reader, obj interface{}) error {
decoder := xml.NewDecoder(r)
if err := decoder.Decode(obj); err != nil {
return err
}