mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-18 19:57:06 +00:00
[Go] Bypass object decode in case of empty body (#4546)
Fixes #4545 Change-Id: Ic724843713f60f996ed72326ad6ef6762ec2e713
This commit is contained in:
@@ -351,6 +351,9 @@ func (c *APIClient) prepareRequest(
|
||||
}
|
||||
|
||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||
if len(b) == 0 {
|
||||
return nil
|
||||
}
|
||||
if s, ok := v.(*string); ok {
|
||||
*s = string(b)
|
||||
return nil
|
||||
|
||||
@@ -350,6 +350,9 @@ func (c *APIClient) prepareRequest(
|
||||
}
|
||||
|
||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||
if len(b) == 0 {
|
||||
return nil
|
||||
}
|
||||
if s, ok := v.(*string); ok {
|
||||
*s = string(b)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user