forked from loafle/openapi-generator-original
[Go] Bypass object decode in case of empty body (#4546)
Fixes #4545 Change-Id: Ic724843713f60f996ed72326ad6ef6762ec2e713
This commit is contained in:
parent
8ff1aca4f8
commit
1ccf4b9cb3
@ -339,6 +339,9 @@ func (c *APIClient) prepareRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||||
|
if len(b) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if s, ok := v.(*string); ok {
|
if s, ok := v.(*string); ok {
|
||||||
*s = string(b)
|
*s = string(b)
|
||||||
return nil
|
return nil
|
||||||
|
@ -339,6 +339,9 @@ func (c *APIClient) prepareRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||||
|
if len(b) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if s, ok := v.(*string); ok {
|
if s, ok := v.(*string); ok {
|
||||||
*s = string(b)
|
*s = string(b)
|
||||||
return nil
|
return nil
|
||||||
|
@ -351,6 +351,9 @@ func (c *APIClient) prepareRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||||
|
if len(b) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if s, ok := v.(*string); ok {
|
if s, ok := v.(*string); ok {
|
||||||
*s = string(b)
|
*s = string(b)
|
||||||
return nil
|
return nil
|
||||||
|
@ -350,6 +350,9 @@ func (c *APIClient) prepareRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
|
||||||
|
if len(b) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if s, ok := v.(*string); ok {
|
if s, ok := v.(*string); ok {
|
||||||
*s = string(b)
|
*s = string(b)
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user