forked from loafle/openapi-generator-original
File return type fix (#5644)
* file return type fix * Update client.mustache
This commit is contained in:
parent
15d58dc89b
commit
cd88c06372
@ -9,6 +9,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
@ -392,6 +393,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user