FormURLEncoded¶
Parsed application/x-www-form-urlencoded key-value pairs with lookup.
This format is used for both URI query strings and HTTP POST request bodies.
Stores decoded key-value pairs in their original order. Duplicate keys
are preserved — use get() for the first value or get_all() for every
value associated with a key. Lookups are linear scans, which is
appropriate for the small pair counts typical of form-encoded data.
For URI query strings, URI.query_params() is a convenience wrapper
that calls ParseFormURLEncoded on the URI's query component. For HTTP
POST bodies, call ParseFormURLEncoded directly on the body string.
Constructors¶
create¶
Create from an array of decoded key-value pairs.
Parameters¶
Returns¶
- FormURLEncoded val^
Public Functions¶
apply¶
The pair at index i. Raises an error if out of bounds.
Parameters¶
- i: USize val
Returns¶
get¶
First value for key, or None if the key is absent.
When duplicate keys are possible and all values are needed, use
get_all() instead.
Parameters¶
- key: String val
Returns¶
get_all¶
All values for key, in order. Empty array if absent.
Parameters¶
- key: String val
Returns¶
contains¶
Whether key is present.
Parameters¶
- key: String val
Returns¶
- Bool val
pairs¶
All pairs in their original order.
Returns¶
size¶
Number of pairs, including duplicates.
Returns¶
- USize val