Check option.
This commit is contained in:
parent
decb16d790
commit
7c776b81a5
2 changed files with 9 additions and 4 deletions
|
@ -12,9 +12,9 @@
|
|||
return this.options[option_id] = value;
|
||||
};
|
||||
|
||||
Curl.prototype.setopt = function(ooption, value) {
|
||||
Curl.prototype.setopt = function(option_name, value) {
|
||||
var option, option_id;
|
||||
option = ooption.toUpperCase();
|
||||
option = option_name.toUpperCase();
|
||||
if ((option_id = Curl.user_options[option]) != null) {
|
||||
this.setopt_user_(option_id, value);
|
||||
} else if ((option_id = Curl.slist_options[option]) != null) {
|
||||
|
@ -22,6 +22,9 @@
|
|||
} else if ((option_id = Curl.integer_options[option]) != null) {
|
||||
this.setopt_int_(option_id, value >> 0);
|
||||
} else if ((option_id = Curl.string_options[option]) != null) {
|
||||
if (value == null) {
|
||||
throw new Error("Cannot set option " + option_name + " to " + value + ".");
|
||||
}
|
||||
this.setopt_str_(option_id, value.toString());
|
||||
} else {
|
||||
throw new Error("unsupported option " + option);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue