Skip to content

len#

The len() function returns the length of the provided argument.

Syntax#

len(value)

Parameters#

  • value: The value to measure the length of. This can be a field name, bytes, array, or map.

Return Value#

Returns an integer representing the length of the provided value.

Example#

len(http.request.uri) // Returns the length of the request URI
len(http.request.headers["User-Agent"]) // Returns the length of the User-Agent header

Use Cases#

  • Checking the length of request URIs to prevent overly long URLs
  • Validating input lengths in request parameters
  • Determining the size of request headers or body