Documentation
¶
Overview ¶
Package httpquery owns bounded query-string parsing and URL generation. It does not bind fields or interpret scalar values; those belong to typed HTTP declarations. Query text uses net/url's form escaping, not path escaping.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Encode ¶
Encode returns a query without a leading question mark. Keys are sorted and each key's value order is preserved, matching url.Values.Encode. Nil and empty value slices omit that key. Every failure returns an empty string.
Input must remain unchanged until return. Native lengths and pair counts are checked before UTF-8 inspection or escaping. Escaping one component may use up to three times its native byte length; retained output never exceeds Bytes.
func Parse ¶
Parse accepts a raw query without its leading question mark. It preserves repeated values and distinguishes an omitted key from a present empty value. As with net/url, a bare key has an empty value and empty slots are ignored. Invalid escapes, unescaped semicolons and invalid UTF-8 reject the entire query. Names and values never appear in error messages.
Bytes and Pairs are checked before allocating decoded strings or containers. Decoded strings may share immutable input storage. Typed bindings decide whether a repeated key, unknown name, empty value or control character is valid.