Skip to content

Commit

Permalink
Renaming attribute from response_body_base64_std to response_body_bas…
Browse files Browse the repository at this point in the history
…e64 (#157)
  • Loading branch information
bendbennett committed Oct 24, 2022
1 parent d1571f2 commit fd8ca19
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ENHANCEMENTS:

* data-source/http: `response_body_base64_std` has been added and contains a standard base64 encoding of the response body ([#158](https://github.com/hashicorp/terraform-provider-http/pull/158)).
* data-source/http: `response_body_base64` has been added and contains a standard base64 encoding of the response body ([#158](https://github.com/hashicorp/terraform-provider-http/pull/158)).
* data-source/http: Replaced issuing warning on the basis of possible non-text `Content-Type` with issuing warning if response body does not contain valid UTF-8. ([#158](https://github.com/hashicorp/terraform-provider-http/pull/158)).

## 3.1.0 (August 30, 2022)
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,6 @@ resource "null_resource" "example" {
- `body` (String, Deprecated) The response body returned as a string. **NOTE**: This is deprecated, use `response_body` instead.
- `id` (String) The URL used for the request.
- `response_body` (String) The response body returned as a string.
- `response_body_base64_std` (String) The response body encoded as base64 (standard) as defined in [RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648#section-4).
- `response_body_base64` (String) The response body encoded as base64 (standard) as defined in [RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648#section-4).
- `response_headers` (Map of String) A map of response header field names and values. Duplicate headers are concatenated according to [RFC2616](https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2).
- `status_code` (Number) The HTTP response status code.
4 changes: 2 additions & 2 deletions internal/provider/data_source_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ your control should be treated as untrustworthy.`,
DeprecationMessage: "Use response_body instead",
},

"response_body_base64_std": {
"response_body_base64": {
Description: "The response body encoded as base64 (standard) as defined in [RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648#section-4).",
Type: types.StringType,
Computed: true,
Expand Down Expand Up @@ -232,6 +232,6 @@ type modelV0 struct {
ResponseHeaders types.Map `tfsdk:"response_headers"`
ResponseBody types.String `tfsdk:"response_body"`
Body types.String `tfsdk:"body"`
ResponseBodyBase64Std types.String `tfsdk:"response_body_base64_std"`
ResponseBodyBase64Std types.String `tfsdk:"response_body_base64"`
StatusCode types.Int64 `tfsdk:"status_code"`
}
4 changes: 2 additions & 2 deletions internal/provider/data_source_http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func TestDataSource_ResponseBodyText(t *testing.T) {
}`, svr.URL),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.http.http_test", "response_body", "你好世界"),
resource.TestCheckResourceAttr("data.http.http_test", "response_body_base64_std", "5L2g5aW95LiW55WM"),
resource.TestCheckResourceAttr("data.http.http_test", "response_body_base64", "5L2g5aW95LiW55WM"),
),
},
},
Expand Down Expand Up @@ -394,7 +394,7 @@ func TestDataSource_ResponseBodyBinary(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
// Note the replacement character in the string representation in `response_body`.
resource.TestCheckResourceAttr("data.http.http_test", "response_body", "GIF89a\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00!�\x04\x01\x00\x00\x00\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;"),
resource.TestCheckResourceAttr("data.http.http_test", "response_body_base64_std", "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="),
resource.TestCheckResourceAttr("data.http.http_test", "response_body_base64", "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="),
),
},
},
Expand Down

0 comments on commit fd8ca19

Please sign in to comment.