Use same function to parse all params whether from query string or headers