summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-09-16 08:34:20 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-09-16 08:34:20 (GMT)
commit9ca1f111a0ee7859fdec16b4f4d2f7fcf3530c35 (patch)
tree4b0ff5bd3951d7c8c1e8f87111de77ff825d1cf3 /tests
parentef09f86d39a751b46143aa33f2ee808b31a6a984 (diff)
parentb70ab023a4e2ec3bfb8ebccf59b92519d5a5dbba (diff)
downloadtcl-9ca1f111a0ee7859fdec16b4f4d2f7fcf3530c35.zip
tcl-9ca1f111a0ee7859fdec16b4f4d2f7fcf3530c35.tar.gz
tcl-9ca1f111a0ee7859fdec16b4f4d2f7fcf3530c35.tar.bz2
[Bug 3391977]: Ensure that the -headers option to http::geturl overrides the
-type option (important because -type has a default that is not always appropriate, and the header must not be duplicated).
Diffstat (limited to 'tests')
-rw-r--r--tests/http.test26
-rw-r--r--tests/httpd8
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/http.test b/tests/http.test
index e6e7649..d9c1efb 100644
--- a/tests/http.test
+++ b/tests/http.test
@@ -364,6 +364,32 @@ test http-3.26 {http::meta} -setup {
http::cleanup $token
unset -nocomplain m token
} -result {Content-Length Content-Type Date X-Check}
+test http-3.27 {http::geturl: -headers override -type} -body {
+ set token [http::geturl $url/headers -type "text/plain" -query dummy \
+ -headers [list "Content-Type" "text/plain;charset=utf-8"]]
+ http::data $token
+} -cleanup {
+ http::cleanup $token
+} -match regexp -result {(?n)Accept \*/\*
+Host .*
+User-Agent .*
+Connection close
+Content-Type {text/plain;charset=utf-8}
+Accept-Encoding .*
+Content-Length 5}
+test http-3.28 {http::geturl: -headers override -type default} -body {
+ set token [http::geturl $url/headers -query dummy \
+ -headers [list "Content-Type" "text/plain;charset=utf-8"]]
+ http::data $token
+} -cleanup {
+ http::cleanup $token
+} -match regexp -result {(?n)Accept \*/\*
+Host .*
+User-Agent .*
+Connection close
+Content-Type {text/plain;charset=utf-8}
+Accept-Encoding .*
+Content-Length 5}
test http-4.1 {http::Event} -body {
set token [http::geturl $url -keepalive 0]
diff --git a/tests/httpd b/tests/httpd
index 5272385..f810797 100644
--- a/tests/httpd
+++ b/tests/httpd
@@ -175,6 +175,14 @@ proc httpdRespond { sock } {
set html "Got [string length $data(query)] bytes"
set type text/plain
}
+ *headers* {
+ set html ""
+ set type text/plain
+ foreach {key value} $data(meta) {
+ append html [list $key $value] "\n"
+ }
+ set html [string trim $html]
+ }
default {
set type text/html