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
diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go
index 3a0a439f..96f9a5ba 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go+++ b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go@@ -285,17 +285,24 @@ func WithErrorUnlessStatusCode(codes ...int) autorest.RespondDecorator {
var e RequestError
defer resp.Body.Close()
+ var encodedAs autorest.EncodedAs+ if resp.Header.Get("Content-Type") == "application/xml" {+ encodedAs = autorest.EncodedAsXML+ } else {+ encodedAs = autorest.EncodedAsJSON+ }+
// Copy and replace the Body in case it does not contain an error object.
// This will leave the Body available to the caller.
- b, decodeErr := autorest.CopyAndDecode(autorest.EncodedAsJSON, resp.Body, &e)+ b, decodeErr := autorest.CopyAndDecode(encodedAs, resp.Body, &e)
but apparently more code needs to be changed to get it working.
If this is not a proper place for this issue, feel free to move it to other repository or point me where I should create it.
The text was updated successfully, but these errors were encountered:
As a follow up to hashicorp/terraform-provider-azurerm#3939 and /hashicorp/terraform-provider-azurerm#3925. Currently when you use go-autorest and XML error is returned from Azure API, go-autorest fails to decode it, as it has hardcoded treating error messages as JSON:
I've tried some dummy fixes borrowed from https://github.com/Azure/azure-sdk-for-go/blob/master/storage/client.go#L977:
but apparently more code needs to be changed to get it working.
If this is not a proper place for this issue, feel free to move it to other repository or point me where I should create it.
The text was updated successfully, but these errors were encountered: