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

Allow XML Content-Type #99

Closed
jeremymcgee73 opened this issue Nov 4, 2021 · 4 comments · Fixed by #158
Closed

Allow XML Content-Type #99

jeremymcgee73 opened this issue Nov 4, 2021 · 4 comments · Fixed by #158

Comments

@jeremymcgee73
Copy link

Hello,
I believe the issue is that XML content type is not allowed in the return.

Terraform Version

Terraform v0.14.9

Affected Resource(s)

  • data.http

Terraform Configuration Files

data "http" "what_xml" {
  url = "https://whatever.com/file.xml"
  # Optional request headers
  request_headers = {
    Accept = "application/xml"
  }
}

Debug Output

Warning: Content-Type is not recognized as a text type, got "application/xml;charset=UTF-8"

  on keycloak.tf line 24, in data "http" "what_xml":
  24: data "http" "what_xml" {

If the content is binary data, Terraform may not properly handle the contents
of the response.

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

The HTTP request should be saved into the body.

Actual Behavior

An error occured.

References

@jeremymcgee73
Copy link
Author

Thanks so much! Do you think we could get a new release for this?

Thanks!

@dracut5
Copy link

dracut5 commented Mar 15, 2022

Faced with the same issue. I see the fix is already merged, would be great to have a new release.

Thank you!

@bendbennett
Copy link
Contributor

bendbennett commented Jul 11, 2022

@jeremymcgee73 @dracut5 it seems that content-types that are not recognised as text have been "allowed" since v2.0.0 in that if the content-type is not identified as text then a warning is issued but the body (or response_body since v2.2.0) should still be populated with a string representation of the response body.

There is an open PR to include an additional attribute, response_body_base64_std which is intended to hold a standard base64 encoding of the response body.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants