( query: Record<string, string[]>, transforms: Transform[] )
| 174 | } |
| 175 | |
| 176 | function applyQueryTransforms( |
| 177 | query: Record<string, string[]>, |
| 178 | transforms: Transform[] |
| 179 | ): void { |
| 180 | for (const transform of transforms) { |
| 181 | if (transform.type === 'request.query' && 'target' in transform) { |
| 182 | applyTransform(query, transform, false); |
| 183 | } |
| 184 | } |
| 185 | for (const key of Object.keys(query)) { |
| 186 | const value = query[key]; |
| 187 | if (value === undefined) { |
| 188 | delete query[key]; |
| 189 | } else if (typeof value === 'string') { |
| 190 | query[key] = [value]; |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | const HEADER_NAME_RE = /^[-\w]+$/; |
| 196 | const HEADER_VALUE_RE = /^[-\w:;.,/\\"'?!(){}[\]@<>=+*#$&`|~%^ ]+$/; |
no test coverage detected