mirror of
https://github.com/httpie/cli.git
synced 2024-11-28 10:43:24 +01:00
modify process_body function to correctly access the nested keys
This commit is contained in:
parent
8377dedf4d
commit
17f875041d
@ -273,8 +273,18 @@ class FilterStream(EncodedStream):
|
||||
chunk = self.decode_chunk(chunk)
|
||||
chunk_dict = eval(chunk)
|
||||
for word in self.filters:
|
||||
if word in chunk_dict:
|
||||
del chunk_dict[word]
|
||||
temp_dict = chunk_dict
|
||||
splitwords = word.split(".")
|
||||
for i in range(len(splitwords)-1):
|
||||
subword = splitwords[i]
|
||||
if subword in temp_dict:
|
||||
temp_dict = temp_dict[subword]
|
||||
else:
|
||||
break
|
||||
else:
|
||||
subword = splitwords[-1]
|
||||
if subword in temp_dict:
|
||||
del temp_dict[subword]
|
||||
chunk = f'{chunk_dict}'
|
||||
return smart_encode(chunk, self.output_encoding)
|
||||
|
||||
@ -308,6 +318,7 @@ class PrettyFilterStream(PrettyStream):
|
||||
temp_dict = temp_dict[subword]
|
||||
else:
|
||||
break
|
||||
else:
|
||||
subword = splitwords[-1]
|
||||
if subword in temp_dict:
|
||||
del temp_dict[subword]
|
||||
|
Loading…
Reference in New Issue
Block a user