diff --git a/private/protocol/restxml/restxml.go b/private/protocol/restxml/restxml.go | |
index 65faeae..27e0e86 100644 | |
--- a/private/protocol/restxml/restxml.go | |
+++ b/private/protocol/restxml/restxml.go | |
@@ -8,7 +8,10 @@ package restxml | |
import ( | |
"bytes" | |
"encoding/xml" | |
+ "fmt" | |
"io" | |
+ "strings" | |
+ "unicode" | |
request "github.com/aws/aws-sdk-go-v2/aws" | |
"github.com/aws/aws-sdk-go-v2/aws/awserr" | |
@@ -66,12 +69,29 @@ func Build(r *request.Request) { | |
// Unmarshal unmarshals a payload response for the REST XML protocol. | |
func Unmarshal(r *request.Request) { | |
+ fmt.Println("HELLO UNMARSHAL", rest.PayloadType(r.Data)) | |
if t := rest.PayloadType(r.Data); t == "structure" || t == "" { | |
defer r.HTTPResponse.Body.Close() | |
- decoder := xml.NewDecoder(r.HTTPResponse.Body) | |
+ buf := new(bytes.Buffer) | |
+ buf.ReadFrom(r.HTTPResponse.Body) | |
+ printOnly := func(r rune) rune { | |
+ if unicode.IsPrint(r) { | |
+ return r | |
+ } | |
+ return -1 | |
+ } | |
+ xmlData := []byte(strings.Map(printOnly, string(buf.Bytes()))) | |
+ | |
+ // fmt.Println("DATA", r.Data) | |
+ | |
+ // newStr := buf.String() | |
+ // fmt.Printf("HEXDUMP\n%x\n", buf.Bytes()) | |
+ // fmt.Println("XMLDATA:", buf.Bytes()) | |
+ decoder := xml.NewDecoder(bytes.NewReader(xmlData)) | |
err := xmlutil.UnmarshalXML(r.Data, decoder, "") | |
if err != nil { | |
- r.Error = awserr.New("SerializationError", "failed to decode REST XML response", err) | |
+ fmt.Println("ERROR", err) | |
+ r.Error = awserr.New("SerializationError", "failed to decode REST XML response 11111111111", err) | |
return | |
} | |
} else { | |
(END) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment