Issue #54 Method suggestion proposal

This commit is contained in:
Vladimir Berkutov committed 2012-06-16 20:08:31 +04:00
1 parent e06c448a75
commit 78fff98712
3 files changed
+15

No files matched your search

+7
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env python
import re
import sys
import json
@@ -40,6 +41,12 @@ def _get_response(parser, args, stdin, stdin_isatty):
# Form
args.headers['Content-Type'] = TYPE_FORM
if args.method is None and not args.items:
args.method = 'GET'
elif not re.match('^[a-zA-Z]+$', args.method):
args.items.insert(0, args.url)
args.method, args.url = 'POST', args.method
# Fire the request.
try:
credentials = None
+2
View File
@@ -171,6 +171,8 @@ parser.add_argument(
parser.add_argument(
'method', metavar='METHOD',
nargs='?',
default=None,
help=_('''
The HTTP method to be used for the request
(GET, POST, PUT, DELETE, PATCH, ...).