http/query.bend checks
raw source on the hub · import 0x33fa1e8e9ce79cb0b4983b81c36ecdd3/http/query.bend as Query
3 imports
import Base import ./text.bend as T import ../utf8/utf8.bend as U
Types
type Param source · line 7 · raw
Data
a query string's pairs, in order and with repeats kept: ?tag=a&tag=b is two pairs, which a map would lose (application/x-www-form-urlencoded)
Param@key:String -> @value:String -> Param
Definitions
def hex source · line 10 · raw
@+x:U32 -> Maybe<&2, U32>
def pct.byte source · line 15 · raw
@a:Maybe<&2, U32> -> @b:Maybe<&2, U32> -> Maybe<&2, U32>
def pct.push source · line 22 · raw
@m:Maybe<&2, U32> -> @+x:U32 -> @+y:U32 -> @out:List<&2, U32> -> List<&2, U32>
def bytes.go source · line 31 · raw
@s:String -> @out:List<&2, U32> -> List<&2, U32>
the bytes of a component: %XX is a byte, + a space; a % not followed by two hex digits stays as it is
def text.of source · line 42 · raw
@t:0x33fa1e8e9ce79cb0b4983b81c36ecdd3/utf8/utf8.Text -> String
def decode source · line 50 · raw
@s:String -> String
a component decoded: bytes that are not UTF-8 end it where they start
def pair source · line 53 · raw
@c:0x33fa1e8e9ce79cb0b4983b81c36ecdd3/http/text.Cut -> Param
def add source · line 60 · raw
@p:String -> @acc:List<&2, Param> -> List<&2, Param>
def parse.go source · line 68 · raw
@fuel:Nat -> @c:0x33fa1e8e9ce79cb0b4983b81c36ecdd3/http/text.Cut -> @acc:List<&2, Param> -> List<&2, Param>
c is the query cut at its first &: the pair before it, and what follows
def parse source · line 76 · raw
@+q:String -> List<&2, Param>
the pairs of a query string, without its ?