Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Function

parse_uri — parse a string URI into a structured record

Synopsis

parse_uri(uri: string) -> record

Description

The parse_uri function parses the uri argument that must have the form of a Universal Resource Identifier into a structured URI comprising the parsed components as a record with the following type signature:

{
  scheme: string,
  opaque: string,
  user: string,
  password: string,
  host: string,
  port: uint16,
  path: string,
  query: |{string:[string]}|,
  fragment: string
}

Examples


# spq
values parse_uri(this)
# input
"scheme://user:password@host:12345/path?a=1&a=2&b=3&c=#fragment"
# expected output
{scheme:"scheme",opaque:null::string,user:"user",password:"password",host:"host",port:12345::uint16,path:"/path",query:|{"a":["1","2"],"b":["3"],"c":[""]}|,fragment:"fragment"}