Commit 57f8ed97 57f8ed976960be98c76eb54171f7c6b947cee162 by Sean Massa

adjusted method check to work properly with non-string values

1 parent 25ad1e79
......@@ -1357,8 +1357,7 @@ Casper.prototype.open = function open(location, settings) {
// http method
// taken from https://github.com/ariya/phantomjs/blob/master/src/webpage.cpp#L302
var methods = ["get", "head", "put", "post", "delete"];
var lowerCaseMethod = settings.method.toLowerCase();
if (settings.method && (!utils.isString(settings.method) || methods.indexOf(lowerCaseMethod) === -1)) {
if (settings.method && (!utils.isString(settings.method) || methods.indexOf(settings.method.toLowerCase()) === -1)) {
throw new CasperError("open(): settings.method must be part of " + methods.join(', '));
}
// http data
......