mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 10:32:42 +00:00
File return type fix (#5644)
* file return type fix * Update client.mustache
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -392,6 +393,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err
|
|||||||
*s = string(b)
|
*s = string(b)
|
||||||
return nil
|
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 xmlCheck.MatchString(contentType) {
|
||||||
if err = xml.Unmarshal(b, v); err != nil {
|
if err = xml.Unmarshal(b, v); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user