diff options
author | oehhar <harald.oehlmann@elmicron.de> | 2020-09-30 12:19:53 (GMT) |
---|---|---|
committer | oehhar <harald.oehlmann@elmicron.de> | 2020-09-30 12:19:53 (GMT) |
commit | 20d206c4c2207a55f0d7bb4f0f81175deef3074f (patch) | |
tree | 1de2605e510e687c114eada96d964674bce390d5 | |
parent | 98a93d4ca72e9eb4dc7d6c33e9f75f2449cb01cf (diff) | |
download | tcl-20d206c4c2207a55f0d7bb4f0f81175deef3074f.zip tcl-20d206c4c2207a55f0d7bb4f0f81175deef3074f.tar.gz tcl-20d206c4c2207a55f0d7bb4f0f81175deef3074f.tar.bz2 |
Ticket [0063cbcada]: From tcl 8.7 on, use "string is dict" instead "string is list" & length %2 == 0 to check for a valid dict
-rw-r--r-- | library/http/http.tcl | 7 | ||||
-rw-r--r-- | tests/http.test | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl index 2dfcb8b..58bbee1 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -746,7 +746,7 @@ proc http::geturl {url args} { -strict boolean -timeout integer -validate boolean - -headers list + -headers dict } set state(charset) $defaultCharset set options { @@ -761,9 +761,8 @@ proc http::geturl {url args} { if {[regexp -- $pat $flag]} { # Validate numbers if { - ([info exists type($flag)] && - ![string is $type($flag) -strict $value]) || - $flag eq "-headers" && [llength $value] %2 != 0 + [info exists type($flag)] && + ![string is $type($flag) -strict $value] } { unset $token return -code error \ diff --git a/tests/http.test b/tests/http.test index b83ddef..a525691 100644 --- a/tests/http.test +++ b/tests/http.test @@ -446,7 +446,7 @@ test http-3.33 {http::geturl application/xml is text} -body { } -result {test 4660 /test} test http-3.34 {http::geturl -headers not a dict} -returnCodes error -body { http::geturl http://test/t -headers NoDict -} -result {Bad value for -headers (NoDict), must be list} +} -result {Bad value for -headers (NoDict), must be dict} test http-4.1 {http::Event} -body { set token [http::geturl $url -keepalive 0] |