Skip to content

Commit

Permalink
Updating docs to include examples of HEAD and POST requests (hashicor…
Browse files Browse the repository at this point in the history
  • Loading branch information
bendbennett authored Aug 24, 2022
1 parent f0b19bf commit dcf674f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/data-sources/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ data "http" "example" {
Accept = "application/json"
}
}
# The following example shows how to issue an HTTP HEAD request.
data "http" "example_head" {
url = "https://checkpoint-api.hashicorp.com/v1/check/terraform"
method = "HEAD"
}
# The following example shows how to issue an HTTP POST request
# supplying an optional request body.
data "http" "example_post" {
url = "https://checkpoint-api.hashicorp.com/v1/check/terraform"
method = "POST"
# Optional request body
request_body = "request body"
}
```

## Usage with Postcondition
Expand Down
16 changes: 16 additions & 0 deletions examples/data-sources/http/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,19 @@ data "http" "example" {
Accept = "application/json"
}
}

# The following example shows how to issue an HTTP HEAD request.
data "http" "example_head" {
url = "https://checkpoint-api.hashicorp.com/v1/check/terraform"
method = "HEAD"
}

# The following example shows how to issue an HTTP POST request
# supplying an optional request body.
data "http" "example_post" {
url = "https://checkpoint-api.hashicorp.com/v1/check/terraform"
method = "POST"

# Optional request body
request_body = "request body"
}

0 comments on commit dcf674f

Please sign in to comment.