[go] support decoding plain string responses
For the following spec:
``` yaml
responses:
"200":
description: Pong.
content:
text/plain:
schema:
type: string
```
The generated client currently fails with `undefined response type`.
In this scenario, `v interface{}` is a string pointer which can be
populated regardless of the content-type.
@@ -317,6 +317,10 @@ func (c *APIClient) prepareRequest(
}
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
+ if s, ok := v.(*string); ok {
+ *s = string(b)
+ return nil
+ }
if xmlCheck.MatchString(contentType) {
if err = xml.Unmarshal(b, v); err != nil {
return err
