For AI agents: the complete documentation index is available at /hclapi/llms.txt, the full documentation bundle is available at /hclapi/llms-full.txt, and this page is available as Markdown at /hclapi/docs/manifest/functions/encoding/url_encode.md.

url_encode

Escapes characters in a string to make it safe for inclusion inside a URL query parameter.

Signature

url_encode(str: string) -> string

Parameters

ParameterTypeRequiredDescription
strstringyesThe string to escape

Return value

Returns the documented result for the function signature.

Example

respond {
  status = 302
  headers = {
    "Location" = "https://idp.example.com/oauth?redirect_uri=${url_encode(ctx.request.query.callback)}"
  }
}