~/bend-docscommunity

lib.bend checks

raw source on the hub · import 0x4c13780015689c83e56d725a171fc6e9/lib.bend as Lib

Url — a small Base-only URL parser and builder for Bend 2.0.2.

Url v1 models four textual fields: scheme, host, path, and query. Parsing is deliberately narrower than RFC 3986: only absolute http:// and https:// URLs are accepted; the authority must contain a non-empty host and no userinfo. Paths and queries are retained as text, without percent decoding.

1 import
import Base

Types

type Url source · line 9 · raw

Data

Definitions

def Url.make source · line 13 · raw

@scheme:String -> @host:String -> @path:String -> @query:String -> Url

Construct a URL value without validation. Use Url.parse for the v1 grammar.

def Url.parse.path source · line 17 · raw

@scheme:String -> @host:String -> @query:String -> @+tail:List<&2, String> -> Maybe<&2, Url>

Parse a slash-delimited path tail.

def Url.parse.authority.host source · line 36 · raw

@scheme:String -> @query:String -> @host:String -> @+tail:List<&2, String> -> Maybe<&2, Url>

Reject empty hosts and the userinfo marker before building a URL.

def Url.parse.authority source · line 55 · raw

@scheme:String -> @query:String -> @+parts:List<&2, String> -> Maybe<&2, Url>

Parse the authority and path after query splitting. The first slash-delimited component is the host; the remaining components are rejoined verbatim.

def Url.parse.query source · line 68 · raw

@scheme:String -> @+parts:List<&2, String> -> Maybe<&2, Url>

A query is optional but, when present, must occur exactly once. Fragment syntax is outside this subset and is rejected by parse.scheme.

def Url.parse.after_scheme source · line 82 · raw

@scheme:String -> @+rest:String -> Maybe<&2, Url>

def Url.parse.https.t8 source · line 95 · raw

@s:String -> Maybe<&2, Url>

Match the fixed lowercase "http://" or "https://" prefix without duplicating the input string in a Boolean branch.

def Url.parse.https.t7 source · line 103 · raw

@s:String -> Maybe<&2, Url>

def Url.parse.https.t6 source · line 111 · raw

@s:String -> Maybe<&2, Url>

def Url.parse.https.t5 source · line 119 · raw

@s:String -> Maybe<&2, Url>

def Url.parse.http.t6 source · line 127 · raw

@s:String -> Maybe<&2, Url>

def Url.parse.http.t5 source · line 135 · raw

@s:String -> Maybe<&2, Url>

def Url.parse.http.t4 source · line 143 · raw

@s:String -> Maybe<&2, Url>

def Url.parse.http.t3 source · line 151 · raw

@s:String -> Maybe<&2, Url>

def Url.parse.http.t2 source · line 159 · raw

@s:String -> Maybe<&2, Url>

def Url.parse.http.t source · line 167 · raw

@s:String -> Maybe<&2, Url>

def Url.parse source · line 178 · raw

@s:String -> Maybe<&2, Url>

Parse one complete absolute HTTP(S) URL. Scheme matching is lowercase and exact. No whitespace, fragment, percent decoding, or DNS validation is imposed beyond the no-userinfo host rule.

def Url.to_string.query source · line 187 · raw

@+head:String -> @query:String -> String

Render the four fields in the v1 wire form. An empty query omits '?'.

def Url.to_string source · line 194 · raw

@u:Url -> String

def Url.build source · line 201 · raw

@u:Url -> String

def Url.show source · line 204 · raw

@u:Url -> String

def Url.join_path.finish source · line 209 · raw

@+acc:String -> @+segment:String -> @last_slash:Bool -> String

Join one non-empty relative path segment to an existing URL path. A segment beginning with '/' is not stripped; callers should pass "users", not "/users".

def Url.join_path.scan source · line 220 · raw

@path:String -> @+segment:String -> @+acc:String -> @last_slash:Bool -> String

def Url.join_path.path source · line 237 · raw

@path:String -> @+segment:String -> String

def Url.join_path.segment source · line 240 · raw

@scheme:String -> @host:String -> @path:String -> @query:String -> @+segment:String -> Url

def Url.join_path source · line 258 · raw

@u:Url -> @+segment:String -> Url