body, err := ioutil.ReadAll(res.Body)
fmt.Println("post send success")
fmt.Printf("type is %T\n", body)
fmt.Printf("body is %#v\n", body)
结果:
post send success
type is []uint8
<?xml version="1.0" encoding="utf-8" ?>
body is []byte{0x3c, 0x3f, 0x78, 0x6d, 0x6c, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x31, 0x2e, 0x30, 0x22, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x3d, 0x22, 0x75, 0x74, 0x66, 0x2d, 0x38, 0x22, 0x20, 0x3f, 0x 3e, 0x3c, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x6d, 0x73, 0x3e, 0xa, 0x20, 0x3c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x3e, 0xa, 0x20, 0x3c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x3e, 0x32, 0x3c, 0x2f, 0x65, 0x72, 0x7 2, 0x6f, 0x72, 0x3e, 0xa, 0x20, 0x3c, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x3e, 0x73, 0x69, 0x67, 0x6e, 0xe5, 0x8f, 0x82, 0xe6, 0x95, 0xb0, 0xe9, 0x94, 0x99, 0xe8, 0xaf, 0xaf, 0x3c, 0x2f, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x3e, 0xa, 0x20, 0x3c , 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x3e, 0xa, 0x20, 0x3c, 0x2f, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x6d, 0x73, 0x3e, 0xa, 0x20}
有疑问加站长微信联系(非本文作者)

<?xml version="1.0" encoding="utf-8" ?><returnsms><br> <errorstatus><br> <error>2</error><br> <remark>sign 参数错误</remark><br> </errorstatus><br> </returnsms><br> 是 string() 后的打印结果<br>
这是字节,直接用xml解析出来