move params parsing inside conditional that checks for their existence to pass bad request response test