Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failures in IAM tests #691

Merged
merged 1 commit into from
Jul 8, 2024
Merged

Fix failures in IAM tests #691

merged 1 commit into from
Jul 8, 2024

Conversation

ararslan
Copy link
Member

@ararslan ararslan commented Jul 3, 2024

The test is expecting an AWSException with code "InvalidAction" but the caught exception had code 404. It appears to be because the response body is XML but AWS didn't set the Content-Type header nor did it begin the response body with a clear indicator of the content type, so the body doesn't get properly parsed. To fix this, we can expand the set of things we look for to determine when to parse as XML. Previously we were only looking for /xml at the end of the content or <?xml at the beginning of the body, but the error response has neither, so here I've added a check for <\w+ xmlns= at the beginning of the body. This seems to be the expected format of an XML response when the <?xml line is absent. Documentation suggests that <?xml would only be absent in the case of an ErrorResponse but that the Content-Type header would be set to text/xml. Evidently not true in practice...

Should fix #683.

The test is expecting an `AWSException` with code `"InvalidAction"` but
the caught exception had code 404. It appears to be because the response
body is XML but AWS didn't set the `Content-Type` header nor did it
begin the response body with a clear indicator of the content type, so
the body doesn't get properly parsed. To fix this, we can expand the set
of things we look for to determine when to parse as XML. Previously we
were only looking for `/xml` at the end of the content or `<?xml` at the
beginning of the body, but the error response has neither, so here I've
added a check for `<\w+ xmlns=` at the beginning of the body. This seems
to be the expected format of an XML response when the `<?xml` line is
absent. Documentation suggests that `<?xml` would only be absent in the
case of an `ErrorResponse` but that the `Content-Type` header would be
set to `text/xml`. Evidently not true in practice...
@ararslan ararslan merged commit 7e92bcf into master Jul 8, 2024
6 checks passed
@ararslan ararslan deleted the aa/error-has-no-content-type branch July 8, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI Failing
2 participants