Standard Library HTTP Actions

action

send_http_request

send_http_request command makes an HTTP request to the given URL and exports the response.

Inputs

  • Name
    url
    Type
    required
    Description

    The URL for the request. Supported schemes are http and https.

  • Name
    request_body
    Type
    optional
    Description

    The request body as a string.

  • Name
    method
    Type
    optional
    Description

    The HTTP Method for the request. Allowed methods are a subset of methods defined in RFC7231: GET, HEAD, and POST. POST support is only intended for read-only URLs, such as submitting a search.

  • Name
    request_timeout_ms
    Type
    optional
    Description

    The request timeout in milliseconds.

  • Name
    request_headers
    Type
    optional
    Description

    A map of request header field names and values.

Outputs

  • Name
    response_body
    Description

    The response body returned as a string.

  • Name
    status_code
    Description

    The HTTP response status code.

Example using send_http_request

action "example" "std::send_http_request" {
  url = "https://example.com"
}

output "status" {
  value = action.example.status_code
}
// > status: 200


Was this page helpful?