You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more of a proposal than a bug report. Feel free to close this issue, if this is not desired behavior for Tornado.
Instead of limiting the AsyncHTTPClient's methods to standard PUT, POST, GET, HEAD and DELETE, Tornado could allow any custom HTTP method to be used. This has some benefits when working with certain applications, like CouchDB, where a non-standard method COPY is used to do an atomic copy of a document.
This behavior could easily be achieved with following patch
diff --git a/tornado/httpclient.py b/tornado/httpclient.py
index e45bfd6..fa152dc 100644
--- a/tornado/httpclient.py
+++ b/tornado/httpclient.py
@@ -390,16 +390,13 @@ def _curl_setup_request(curl, request, buffer, headers):
"PUT": pycurl.UPLOAD,
"HEAD": pycurl.NOBODY,
}
- custom_methods = set(["DELETE"])
for o in curl_options.values():
curl.setopt(o, False)
if request.method in curl_options:
curl.unsetopt(pycurl.CUSTOMREQUEST)
curl.setopt(curl_options[request.method], True)
- elif request.method in custom_methods:
- curl.setopt(pycurl.CUSTOMREQUEST, request.method)
else:
- raise KeyError('unknown method ' + request.method)
+ curl.setopt(pycurl.CUSTOMREQUEST, request.method)
# Handle curl's cryptic options for every individual HTTP method
if request.method in ("POST", "PUT"):
The text was updated successfully, but these errors were encountered:
I don't want this to be the default (since, among other things, the method is currently case-sensitive and I don't know what would happen if you tried to pass in something lowercase), but I've added an option to HTTPRequest that will cause it to allow any method.
This is more of a proposal than a bug report. Feel free to close this issue, if this is not desired behavior for Tornado.
Instead of limiting the AsyncHTTPClient's methods to standard PUT, POST, GET, HEAD and DELETE, Tornado could allow any custom HTTP method to be used. This has some benefits when working with certain applications, like CouchDB, where a non-standard method COPY is used to do an atomic copy of a document.
This behavior could easily be achieved with following patch
The text was updated successfully, but these errors were encountered: