Permalink
Browse files

Fixed a bug with -X

  • Loading branch information...
1 parent fcff81f commit 1b7ad9c20a8621e33a1bc17eeca6dce6920a3773 @mitsuhiko mitsuhiko committed Jul 23, 2012
Showing with 4 additions and 2 deletions.
  1. +3 −1 curlish.py
  2. +1 −1 setup.py
View
@@ -774,9 +774,10 @@ def handle_json_value(value):
fail('Error: malformed json data with -J')
json_pairs.append((dkey, value))
+ last_arg_was_x = False
for idx, arg in enumerate(argiter):
# Automatic -X in front of known http method names
- if arg in KNOWN_HTTP_METHODS:
+ if arg in KNOWN_HTTP_METHODS and not last_arg_was_x:
new_args.append('-X' + arg)
# Shortcut for X-Requested-With
elif arg == '--ajax':
@@ -796,6 +797,7 @@ def handle_json_value(value):
# Regular argument
else:
new_args.append(arg)
+ last_arg_was_x = arg == '-X'
json_data = decode_flat_data(json_pairs)
need_json = bool(json_data)
View
@@ -7,7 +7,7 @@
name='curlish',
author='Fireteam Ltd.',
author_email='support@fireteam.net',
- version='1.14',
+ version='1.15',
url='http://github.com/fireteam/curlish',
py_modules=['curlish'],
description='A wrapper for curl that adds OAuth support',

0 comments on commit 1b7ad9c

Please sign in to comment.