You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Go HTTP Client does not allow for body responses to be populated for HEAD HTTP methods. This means that regardless of whether the server responds with a body the Go client will assign a net/http.noBody type as the response body. This will result in a EOF error from the deserializer which assumes that an XML document can be parsed. We should modify our error deserialization behavior to account for HEAD responses not having a return body present, and should explore having an error that at least surfaces the HTTP StatusCode and Message to the user.
The text was updated successfully, but these errors were encountered:
Not just HEADs in general the SDK probably should not error at all (error or success response) if there is no response payload. The only exception to this being the S3 200 error API customizations. In all other cases the SDK should assume empty response body (e.g. EOF) is OK and should be allowed without failure.
There are some APIs that model no response, but actual return something back which does fit the protocol's format. I think one of the IoT APIs returns a OK literal string (unquoted) that will fail decode because its not valid JSON. But in this case the SDK should not of attempted to deserialize the response at all, and instead just thrown it away. Either delegate to a resp.Body.Close and optional with io.Copy(ioutil.Discard, resp.Body) as well. (discard isn't really needed, Close will do this automatically. (may be needed for eventstream though, but we can investigate that then)
The Go HTTP Client does not allow for body responses to be populated for
HEAD
HTTP methods. This means that regardless of whether the server responds with a body the Go client will assign anet/http.noBody
type as the response body. This will result in aEOF
error from the deserializer which assumes that an XML document can be parsed. We should modify our error deserialization behavior to account forHEAD
responses not having a return body present, and should explore having an error that at least surfaces the HTTP StatusCode and Message to the user.The text was updated successfully, but these errors were encountered: