Skip to content

Commit

Permalink
fix: be extra careful when checking for request data
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosantangelo committed Nov 20, 2019
1 parent 0c054b8 commit b6c7fc8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/server/index.ts
Expand Up @@ -58,11 +58,11 @@ export function handleRequest(
export function extractFromReq<T = string>(req: Request, param: string): T {
let value

if (req.query[param]) {
if (req.query && req.query[param]) {
value = req.query[param]
} else if (req.body[param]) {
} else if (req.body && req.body[param]) {
value = req.body[param]
} else if (req.params[param]) {
} else if (req.params && req.params[param]) {
value = req.params[param]
}

Expand Down

0 comments on commit b6c7fc8

Please sign in to comment.