-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow additional methods in http datasource
This adds support for additional http methods for the http datasource. Fixes #13169 Signed-off-by: Henrik Gerdes <[email protected]>
- Loading branch information
1 parent
6e417bb
commit 6c40bfb
Showing
6 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
source "null" "example" { | ||
communicator = "none" | ||
} | ||
|
||
data "http" "basic" { | ||
url = "https://www.packer.io/" | ||
method = "NONEEXISTING" | ||
} | ||
|
||
locals { | ||
url = "${data.http.basic.url}" | ||
body = "${data.http.basic.body}" != "" | ||
} | ||
|
||
build { | ||
name = "mybuild" | ||
sources = [ | ||
"source.null.example" | ||
] | ||
provisioner "shell-local" { | ||
inline = [ | ||
"echo url is ${local.url}", | ||
"echo body is ${local.body}" | ||
] | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
website/content/partials/datasource/http/Config-not-required.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
<!-- Code generated from the comments of the Config struct in datasource/http/data.go; DO NOT EDIT MANUALLY --> | ||
|
||
- `method` (string) - HTTP method used for the request. Supported methods are `HEAD`, `GET`, `POST`, `PUT`, `DELETE`, `OPTIONS`, `PATCH`. Default is `GET`. | ||
|
||
- `request_headers` (map[string]string) - A map of strings representing additional HTTP headers to include in the request. | ||
|
||
- `request_body` (string) - HTTP request payload send with the request. Default is empty. | ||
|
||
<!-- End of code generated from the comments of the Config struct in datasource/http/data.go; --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!-- Code generated from the comments of the Config struct in datasource/http/data.go; DO NOT EDIT MANUALLY --> | ||
|
||
- `url` (string) - The URL to request data from. This URL must respond with a `200 OK` response and a `text/*` or `application/json` Content-Type. | ||
- `url` (string) - The URL to request data from. This URL must respond with a `2xx` range response code and a `text/*` or `application/json` Content-Type. | ||
|
||
<!-- End of code generated from the comments of the Config struct in datasource/http/data.go; --> |