Explorer

http.url-target-after

description
http.url-target after the scheme: the authority up to the first / and the rest
type
Fn(scheme: @http.scheme, rest: String) -> Record{
  scheme: Union{#none, #some(@http.scheme)},
  authority: Union{#none, #some(String)},
  path_with_query: Union{#none, #some(String)}
}
expression
fn(scheme$0, rest$1) =>
  let slash$2 = @core.string-index-of(text: $1, target: "/", start: 0);
  match @core.less-than(left: $2, right: 0) {
    true =>
      {scheme: #some($0), authority: #some($1), path_with_query: #none},
    false =>
      {
        scheme: #some($0),
        authority: #some(@core.string-slice(value: $1, start: 0, end: $2)),
        path_with_query: #some(@core.string-slice(value: $1, start: $2, end: @core.string-length(value: $1)))
      }
  }
visibility
public
http.url-target-after (project http, branch main, snapshot FuOge41aUHwwPZkx2JW6O-Emair6Jc-D5YsZf5cx6b0)
id: s4DmGdJXC4C2k_yC2ESANy8wzzZDAkTvpdWcswjgWaI
content hash: XMTJp8FlDDm2i7EcVOiHbx31e0r7b5zb9ZUvFxtQ_GY