(query: URLSearchParams, name: string)
| 194 | * cleared. Absent is still an error; empty is a legitimate state. |
| 195 | */ |
| 196 | export function optionalTextParam(query: URLSearchParams, name: string): string { |
| 197 | const raw = query.get(name); |
| 198 | if (raw === null) throw badRequest(`Missing required parameter "${name}".`); |
| 199 | return boundLength(raw, name); |
| 200 | } |
| 201 | |
| 202 | function boundLength(raw: string, name: string): string { |
| 203 | if (raw.length > MAX_QUERY_LENGTH) { |
no test coverage detected