mirror of
https://github.com/httpie/cli.git
synced 2024-11-21 23:33:12 +01:00
Fixed and added test for JSON properties order.
This commit is contained in:
parent
0481957715
commit
a2b12f75ea
@ -640,7 +640,7 @@ def parse_items(items,
|
||||
|
||||
if item.sep in SEP_GROUP_RAW_JSON_ITEMS:
|
||||
try:
|
||||
value = json.loads(value)
|
||||
value = json.loads(value, object_pairs_hook=OrderedDict)
|
||||
except ValueError as e:
|
||||
raise ParseError('"%s": %s' % (item.orig, e))
|
||||
target = data
|
||||
|
@ -63,3 +63,8 @@ class TestHTTPie:
|
||||
assert HTTP_OK in r
|
||||
assert '"User-Agent": "HTTPie' in r, r
|
||||
assert '"Foo": "bar"' in r
|
||||
|
||||
def test_json_order(self, httpbin):
|
||||
r = http('PATCH', httpbin.url + '/patch', 'order:={"map":{"1":"first","2":"second"}}')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['data'] == '{"order": {"map": {"1": "first", "2": "second"}}}'
|
||||
|
Loading…
Reference in New Issue
Block a user