Skip to content

Commit dcf674f

Browse files
authored
Updating docs to include examples of HEAD and POST requests (hashicorp#179) (hashicorp#180)
1 parent f0b19bf commit dcf674f

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

docs/data-sources/http.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,22 @@ data "http" "example" {
4242
Accept = "application/json"
4343
}
4444
}
45+
46+
# The following example shows how to issue an HTTP HEAD request.
47+
data "http" "example_head" {
48+
url = "https://checkpoint-api.hashicorp.com/v1/check/terraform"
49+
method = "HEAD"
50+
}
51+
52+
# The following example shows how to issue an HTTP POST request
53+
# supplying an optional request body.
54+
data "http" "example_post" {
55+
url = "https://checkpoint-api.hashicorp.com/v1/check/terraform"
56+
method = "POST"
57+
58+
# Optional request body
59+
request_body = "request body"
60+
}
4561
```
4662

4763
## Usage with Postcondition

examples/data-sources/http/data-source.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,19 @@ data "http" "example" {
88
Accept = "application/json"
99
}
1010
}
11+
12+
# The following example shows how to issue an HTTP HEAD request.
13+
data "http" "example_head" {
14+
url = "https://checkpoint-api.hashicorp.com/v1/check/terraform"
15+
method = "HEAD"
16+
}
17+
18+
# The following example shows how to issue an HTTP POST request
19+
# supplying an optional request body.
20+
data "http" "example_post" {
21+
url = "https://checkpoint-api.hashicorp.com/v1/check/terraform"
22+
method = "POST"
23+
24+
# Optional request body
25+
request_body = "request body"
26+
}

0 commit comments

Comments
 (0)