[Go] Bypass object decode in case of empty body (#4546)

Fixes #4545

Change-Id: Ic724843713f60f996ed72326ad6ef6762ec2e713
This commit is contained in:
dukov 2019-11-19 19:20:15 -08:00 committed by William Cheng
parent 8ff1aca4f8
commit 1ccf4b9cb3
4 changed files with 12 additions and 0 deletions

View File

@ -339,6 +339,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

View File

@ -339,6 +339,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

View File

@ -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

View File

@ -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