Skip to content

GET and HTTP QUERY readers

Use ReadGET(url.Values) or ReadQUERY(body) to normalize transport data before pipeline admission. These are request readers, not HTTP handlers. Hosting must limit body size and apply status/cache metadata; these functions do not expose routes.

{
"arguments": { "category": "books", "ids": [1, 2] },
"paging": { "page": 0, "pageSize": 10 },
"sorting": { "field": "name", "direction": "ascending" }
}

The body must contain exactly one object. Null/array roots, trailing JSON values, case-insensitive duplicate declared envelope/control members and duplicate argument names fail. Unknown envelope members are permissive. Argument raw JSON is retained; conversion waits until the typed registration is known.

Paging values must be integer tokens within int32 range; decimal/exponent tokens, strings and null integer members fail parsing. Positive size enables paging. Omitted/null sort direction defaults ascending; explicit empty is invalid when sorting is active. Arrays preserve scalar element boundaries. Nested scalar elements fail binding; JSON-node collections require explicit custom bindings.

Reserved names are case-insensitive: page, pageSize, sortby, sortDirection, waitForFirstResult, and waitForFirstResultTimeout. Repeated or case-folded duplicate controls fail; wait controls are excluded from arguments. Observable registrations support bounded first-result waits with Boolean text and positive finite seconds; ordinary snapshots remain unary. For QUERY, the body supplies arguments while URL wait controls remain separate. See observable HTTP. Repeated caller collections collapse through comma splitting and trimming.

Parsed int32 size enables paging even for zero/negative size; active pipeline validation then rejects invalid page/size. Invalid/missing page defaults zero. Sorting requires both nonempty field and direction. Only asc/ascending/desc/descending are accepted, case-insensitively.

QueryStringRequestReader implements method GET with empty cache-control metadata. BodyRequestReader implements QUERY with ResponseCacheControl() == "no-store". Hosting must send that header on success and reader failure, and separately map malformed QUERY syntax to 400. Do not rely solely on result status precedence.

ReadError.Malformed distinguishes syntax/envelope errors from semantic sorting findings. The original parser cause remains inspectable. ArgumentError carries safe rule or malformedRequest findings; SortingError carries a safe field finding. Production exception text must never expose parser input or private diagnostics.

See argument binding for effective presence rules and paging for provider behavior.