http — HTTP client

Make HTTP requests to any URL. Enable with "http" in your tools array.

Functions

FunctionDescription
http.get(url, options?)GET request, returns { status, body, headers }
http.post(url, body, options?)POST request with JSON body
http.put(url, body, options?)PUT request with JSON body
http.delete(url, options?)DELETE request
http.patch(url, body, options?)PATCH request with JSON body

Options

OptionTypeDescription
headersobjectAdditional request headers
timeoutnumberRequest timeout in ms (default: config timeout)
parseJsonbooleanAuto-parse JSON response body (default: true)

Example

terminal
testy-claw run "fetch the GitHub API for this repo and write the star count to stars.txt"

  ✓ http.get("https://api.github.com/repos/org/repo")
    → { stargazers_count: 1204, ... }
  ✓ fs.write("stars.txt", "1204")
  ✓ Done in 1.1s