mirror of
https://github.com/httpie/cli.git
synced 2025-06-27 04:51:28 +02:00
Cleanup
This commit is contained in:
parent
52dd6adaa3
commit
e0cc63c7eb
@ -302,7 +302,7 @@ their type is distinguished only by the separator used:
|
|||||||
| | The ``==`` separator is used |
|
| | The ``==`` separator is used |
|
||||||
+-----------------------+-----------------------------------------------------+
|
+-----------------------+-----------------------------------------------------+
|
||||||
| Data Fields | Request data fields to be serialized as a JSON |
|
| Data Fields | Request data fields to be serialized as a JSON |
|
||||||
| ``field=value``, | object (default), or to be form encoded |
|
| ``field=value``, | object (default), or to be form-encoded |
|
||||||
| ``field=@file.txt`` | (``--form, -f``). |
|
| ``field=@file.txt`` | (``--form, -f``). |
|
||||||
+-----------------------+-----------------------------------------------------+
|
+-----------------------+-----------------------------------------------------+
|
||||||
| Raw JSON fields | Useful when sending JSON and one or |
|
| Raw JSON fields | Useful when sending JSON and one or |
|
||||||
|
@ -97,7 +97,7 @@ positional.add_argument(
|
|||||||
)
|
)
|
||||||
positional.add_argument(
|
positional.add_argument(
|
||||||
'items',
|
'items',
|
||||||
metavar='REQUEST ITEM',
|
metavar='REQUEST_ITEM',
|
||||||
nargs=ZERO_OR_MORE,
|
nargs=ZERO_OR_MORE,
|
||||||
type=KeyValueArgType(*SEP_GROUP_ALL_ITEMS),
|
type=KeyValueArgType(*SEP_GROUP_ALL_ITEMS),
|
||||||
help=r"""
|
help=r"""
|
||||||
|
@ -1265,6 +1265,7 @@ class ItemParsingTest(BaseTestCase):
|
|||||||
self.assertEqual(files['file'][1].read().strip().decode('utf8'),
|
self.assertEqual(files['file'][1].read().strip().decode('utf8'),
|
||||||
FILE_CONTENT)
|
FILE_CONTENT)
|
||||||
|
|
||||||
|
|
||||||
class CLIParserTestCase(unittest.TestCase):
|
class CLIParserTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def test_expand_localhost_shorthand(self):
|
def test_expand_localhost_shorthand(self):
|
||||||
@ -1277,7 +1278,7 @@ class CLIParserTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(args.url, 'http://localhost/')
|
self.assertEqual(args.url, 'http://localhost/')
|
||||||
|
|
||||||
def test_expand_locahost_shorthand_with_port(self):
|
def test_expand_localhost_shorthand_with_port(self):
|
||||||
args = parser.parse_args(args=[':3000'], env=TestEnvironment())
|
args = parser.parse_args(args=[':3000'], env=TestEnvironment())
|
||||||
|
|
||||||
self.assertEqual(args.url, 'http://localhost:3000')
|
self.assertEqual(args.url, 'http://localhost:3000')
|
||||||
@ -1303,14 +1304,23 @@ class CLIParserTestCase(unittest.TestCase):
|
|||||||
self.assertEqual(args.url, 'http://::1')
|
self.assertEqual(args.url, 'http://::1')
|
||||||
|
|
||||||
def test_dont_expand_longer_ipv6_as_shorthand(self):
|
def test_dont_expand_longer_ipv6_as_shorthand(self):
|
||||||
args = parser.parse_args(args=['::ffff:c000:0280'], env=TestEnvironment())
|
args = parser.parse_args(
|
||||||
|
args=['::ffff:c000:0280'],
|
||||||
|
env=TestEnvironment()
|
||||||
|
)
|
||||||
self.assertEqual(args.url, 'http://::ffff:c000:0280')
|
self.assertEqual(args.url, 'http://::ffff:c000:0280')
|
||||||
|
|
||||||
def test_dont_expand_full_ipv6_as_shorthand(self):
|
def test_dont_expand_full_ipv6_as_shorthand(self):
|
||||||
args = parser.parse_args(args=['0000:0000:0000:0000:0000:0000:0000:0001'], env=TestEnvironment())
|
args = parser.parse_args(
|
||||||
|
args=['0000:0000:0000:0000:0000:0000:0000:0001'],
|
||||||
|
env=TestEnvironment()
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
args.url,
|
||||||
|
'http://0000:0000:0000:0000:0000:0000:0000:0001'
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(args.url, 'http://0000:0000:0000:0000:0000:0000:0000:0001')
|
|
||||||
|
|
||||||
class ArgumentParserTestCase(unittest.TestCase):
|
class ArgumentParserTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user