Tea
DocsPlaygroundExamplesReferenceCommunity
GitHub

Tea Language

A strongly typed scripting language for native tools.

© 2026 Tea Language.

ContributingCommunityRepository

Language Runtime

Built-ins

Standard Library

std.argsstd.assertstd.audiostd.envstd.fsstd.httpstd.netstd.jsonstd.parsestd.pathstd.processstd.regexstd.stringstd.timestd.url

Standard Library

std.http

Blocking HTTP client helpers for tool-style scripts.

Exported functions

pub def new_request(method: String, url_text: String) -> Request

Create a request with empty headers/body and no timeout override.

pub def new_request_with(method: String, url_text: String, headers: Dict[String, String], body: String, timeout_ms: Int) -> Request

Create a request with explicit headers, body, and timeout.

pub def with_query(req: Request, params: Dict[String, String]) -> Request

Append query parameters to a request URL.

pub def send(req: Request) -> Response

Send an HTTP request synchronously.

pub def get(url_text: String) -> Response

Send a GET request.

pub def get_with(url_text: String, headers: Dict[String, String]) -> Response

Send a GET request with headers.

pub def post(url_text: String, body: String) -> Response

Send a POST request with a text body.

pub def post_with(url_text: String, headers: Dict[String, String], body: String) -> Response

Send a POST request with headers and a text body.

pub def put(url_text: String, body: String) -> Response

Send a PUT request with a text body.

pub def patch(url_text: String, body: String) -> Response

Send a PATCH request with a text body.

pub def delete(url_text: String) -> Response

Send a DELETE request.

pub def post_json[T](url_text: String, value: T) -> Response

Send a JSON POST request.

pub def decode_json[T](response: Response) -> T

Decode a JSON response body.

pub def header(response: Response, name: String) -> String?

Return a response header by name when present.

pub def header_or(response: Response, name: String, fallback: String) -> String

Return a response header by name or a fallback value.

pub def body_text(response: Response) -> String

Return the text body of a response.

pub def body_bytes(response: Response) -> List[Int]

Return the raw body bytes of a response.

pub def check(response: Response) -> Response

Fail when the response status is not successful.

pub def download(url_text: String, file_path: String) -> Response

Download a URL to a file path and return the response.