summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--library/http/http.tcl6
-rw-r--r--tests/http.test3
2 files changed, 7 insertions, 2 deletions
diff --git a/library/http/http.tcl b/library/http/http.tcl
index eec05b8..2dfcb8b 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -746,6 +746,7 @@ proc http::geturl {url args} {
-strict boolean
-timeout integer
-validate boolean
+ -headers list
}
set state(charset) $defaultCharset
set options {
@@ -760,8 +761,9 @@ proc http::geturl {url args} {
if {[regexp -- $pat $flag]} {
# Validate numbers
if {
- [info exists type($flag)] &&
- ![string is $type($flag) -strict $value]
+ ([info exists type($flag)] &&
+ ![string is $type($flag) -strict $value]) ||
+ $flag eq "-headers" && [llength $value] %2 != 0
} {
unset $token
return -code error \
diff --git a/tests/http.test b/tests/http.test
index 7454ab8..b83ddef 100644
--- a/tests/http.test
+++ b/tests/http.test
@@ -444,6 +444,9 @@ test http-3.33 {http::geturl application/xml is text} -body {
} -cleanup {
catch { http::cleanup $token }
} -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}
test http-4.1 {http::Event} -body {
set token [http::geturl $url -keepalive 0]