D2835: tests: teach get-with-headers to send other request methods
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Tue Mar 13 02:16:37 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
The "get" in "get-with-headers" now makes this a poorly named command.
But renaming it would be rather invasive. It's tempting to invent
a new script to make HTTP requests, since the API of get-with-headers
leaves a lot to be desired. But let's not cross that bridge until
we have a reason to.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2835
AFFECTED FILES
tests/get-with-headers.py
CHANGE DETAILS
diff --git a/tests/get-with-headers.py b/tests/get-with-headers.py
--- a/tests/get-with-headers.py
+++ b/tests/get-with-headers.py
@@ -37,6 +37,8 @@
help='Write HTTP response body to a file')
parser.add_argument('--showdynamicheaders', action='store_true',
help='Show dynamic headers that are hidden by default')
+parser.add_argument('--method', default='GET',
+ help='HTTP request method')
parser.add_argument('host')
parser.add_argument('path')
parser.add_argument('show', nargs='*')
@@ -64,7 +66,7 @@
headers[key] = value
conn = httplib.HTTPConnection(host)
- conn.request("GET", '/' + path, None, headers)
+ conn.request(args.method.encode('ascii'), '/' + path, None, headers)
response = conn.getresponse()
stdout.write(b'%d %s\n' % (response.status,
response.reason.encode('ascii')))
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list