|
2022-05-30
| ||
| 16:23 | • Closed ticket [15e4bd83c2]: http::geturl: Documentation discrepancy on -query {}... artifact: d29107612a user: kjnash | |
|
2022-05-13
| ||
| 02:58 | • Pending ticket [15e4bd83c2]. artifact: 3f6f4c7823 user: kjnash | |
|
2022-05-12
| ||
| 12:59 | • Ticket [15e4bd83c2]: 4 changes artifact: 7e441e04e8 user: oehhar | |
| 01:41 | • Ticket [15e4bd83c2]: 3 changes artifact: cdd2b8588c user: kjnash | |
| 01:36 | • Ticket [15e4bd83c2]: 3 changes artifact: a99b2800b6 user: kjnash | |
|
2022-05-10
| ||
| 22:05 | • Ticket [6afa947d1a] http::geturl : Missing Content-Length header for POST reques... artifact: 70a273226d user: kjnash | |
| 19:29 | • Ticket [15e4bd83c2] http::geturl: Documentation discrepancy on -query {} sta... artifact: a343f96571 user: kjnash | |
|
2021-10-04
| ||
| 16:32 | • New ticket [15e4bd83c2]. artifact: d07780f83b user: oehhar | |
http::geturl: Documentation discrepancy on -query {}
http::geturl $URL -query {}
sends a get request and not a post request.
The documentation of 8.6.11 is: https://www.tcl-lang.org/man/tcl8.6/TclCmd/http.htm#M29
-query query
This flag causes ::http::geturl to do a POST request...
In this corner case, it does not. It sends a get request.
I suppose, we can not change the behaviour. It might be beneficial to change the wording to say that an empty query sends a get request.
Any comments welcome.
Best regards, Harald
Note: for my personal use, it would be handy to send a post request with empty payload.
Hi Harald,
I've just looked at RFC 7230-3 and I cannot see anything that forbids a POST request with no message body. However, it is an unusual case: do you use custom request headers to modify the state of the server?
The behaviour of http::geturl could be changed, but this is a change of API that might break some existing code, and would require an increase in the major version of the http package.
Fortunately, you can use the existing http::geturl to send POST with an empty body by using the options "-method POST -headers {Content-Length 0}".
-method type
Force the HTTP request method to type. ::http::geturl will auto-select GET, POST or HEAD based on other options, but this option enables choices like PUT and DELETE for webdav support.
I will modify the man page http(n) to state that the value for -query must be non-empty to cause the POST method.
Best wishes,
Keith.
Documentation http(n) changed:
For -query, to say that an empty query does not sent a POST, see commit [1b15e55938a9b2fc].
For -method, to describe the case of a POST with no request-body, see commit [751f947bc87f6b2f].
Great, I appreciate ! My use-case was the testing of the TCLWS package and what it does, if there is no data.
Thanks, Harald