Add support for marshalling/unmarshalling JSON#6969
Add support for marshalling/unmarshalling JSON#6969jhendrixMSFT merged 2 commits intoAzure:masterfrom
Conversation
Removed Response.Payload field, replacing it with an internal implementation nopClosingBytesReader.
| // TODO: verify early exit is correct | ||
| if len(r.payload()) == 0 { | ||
| return newRequestError("missing payload", r) | ||
| return nil |
There was a problem hiding this comment.
Just a question, to understand the reason behind returning nil, wouldn't it be better to return an error is the payload empty? Since clearly calling the function means that there was the expectation that something would be unmarshaled?
There was a problem hiding this comment.
That was my original assumption, however the byte_getNull test expects this to be valid. I actually think the swagger is malformed, i.e. the MIME type should be application/text and not application/json as none of the models are actually JSON. We also have this same behavior in track 1, but again it might be predicated on some bad assumptions (i.e. is there ever a valid success case where the swagger specifies a JSON model but the service is allowed to return null).
catalinaperalta
left a comment
There was a problem hiding this comment.
LGTM, just left a question to understand the error handling we're going to use for UnmarshalAsJSON
Removed Response.Payload field, replacing it with an internal
implementation nopClosingBytesReader.