docs-v2/content/flux/v0.x/stdlib/http/pathescape.md

999 B

title description aliases menu weight introduced
http.pathEscape() function The `http.pathEscape()` function escapes special characters in a string (including `/`) and replaces non-ASCII characters with hexadecimal representations (`%XX`).
/influxdb/v2.0/reference/flux/stdlib/http/pathescape/
/influxdb/cloud/reference/flux/stdlib/http/pathescape/
flux_0_x_ref
name parent
http.pathEscape http
202 0.71.0

The http.pathEscape() function escapes special characters in a string (including /) and replaces non-ASCII characters with hexadecimal representations (%XX).

import "http"

http.pathEscape(
    inputString: "/this/is/an/example-path.html"
)

// Returns %2Fthis%2Fis%2Fan%2Fexample-path.html

Parameters

inputString

The string to escape.

Examples

URL-encode strings in a stream of tables
import "http"

data
    |> map(fn: (r) => ({r with path: http.pathEscape(inputString: r.path)}))