Check that query params are actually strings

Previously `toLowerCase` could fail because it tried to perform the
operation on something else than a string.