Fix request format determination (req.format -> req.query.format)