[Go-client] Fix inability to download files
* Revert a change to the Go Client code that broke
the ability to download files. This reverts the change
from
* Missed import for "io/ioutil"
* update samples
@@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"io"
+ "io/ioutil"
"log"
"mime/multipart"
"net/http"
@@ -419,6 +420,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err
*s = string(b)
return nil
}
+ if f, ok := v.(**os.File); ok {
+ *f, err = ioutil.TempFile("", "HttpClientFile")
+ if err != nil {
+ return
+ }
+ _, err = (*f).Write(b)
+ _, err = (*f).Seek(0, io.SeekStart)
+ return
+ }
if xmlCheck.MatchString(contentType) {
if err = xml.Unmarshal(b, v); err != nil {
return err
