(req: express.Request, res: express.Response, to: string, override: qs.ParsedQs = {})
| 186 | * `override` will merge with the existing query (use `undefined` to unset). |
| 187 | */ |
| 188 | export const redirect = (req: express.Request, res: express.Response, to: string, override: qs.ParsedQs = {}): void => { |
| 189 | const query = Object.assign({}, req.query, override) |
| 190 | Object.keys(override).forEach((key) => { |
| 191 | if (typeof override[key] === "undefined") { |
| 192 | delete query[key] |
| 193 | } |
| 194 | }) |
| 195 | |
| 196 | const redirectPath = constructRedirectPath(req, query, to) |
| 197 | logger.debug(`redirecting from ${req.originalUrl} to ${redirectPath}`) |
| 198 | res.redirect(redirectPath) |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Get the value that should be used for setting a cookie domain. This will |
no test coverage detected