The Send methods intentionally return nil, nil when content length is 0 and/or status code is 204. Recently we've experienced occasional panics in our code due to referencing fields on nil response. Those panics exhibited themselves only on a regional data center, leading us to suspect a localized Microsoft-side issue of truncating some responses. We have no evidence, unfortunately, as we haven't captured those responses in their raw form. The issue seems to have subsided by now.
In our code, we call "get" APIs and diligently check err. We have not considered the case of nil, nil since — let's say you're calling GetApplications() and get nil, nil - what does it mean? If it's an error then why err is unset? If it means no applications were found, then why is it not expressed as len(response.GetValue()) == 0?
My proposal would be to return a nil, err in cases when there's a response schema and there's no content in the response to satisfy it.
The Send methods intentionally return
nil, nilwhen content length is 0 and/or status code is 204. Recently we've experienced occasional panics in our code due to referencing fields onnilresponse. Those panics exhibited themselves only on a regional data center, leading us to suspect a localized Microsoft-side issue of truncating some responses. We have no evidence, unfortunately, as we haven't captured those responses in their raw form. The issue seems to have subsided by now.In our code, we call "get" APIs and diligently check
err. We have not considered the case ofnil, nilsince — let's say you're callingGetApplications()and getnil, nil- what does it mean? If it's an error then whyerris unset? If it means no applications were found, then why is it not expressed aslen(response.GetValue()) == 0?My proposal would be to return a
nil, errin cases when there's a response schema and there's no content in the response to satisfy it.