Closed t0mk closed 2 years ago
@displague Looks good, and seem to work. I think we can't run this withou TF_ACC=1 because resource.Test
is checking it inside. I didn't find any other provider which would be using mock to this extent.
Although, if I would be about to put effort into fixing the error mess, I would rather remove the ErrorResponse type from packngo, and treat body of HTTP error responses only as string. I would also remove the ErrorResponse struct here from the provider. That would clean the code a bit, because there wouldn't be casting of ErrorResponse, packngo.ErrorResponse and http.Response. Once the code would be cleaner, it would be easier to fix issues like this.
This PR fixes the situation where the EM API returns HTTP 422, and
errors: []
in the body. Like this:Hopefully fixes #195