fix: detect base64-encoded responses

pull/20/head
Kuba Szczodrzyński 2 years ago
parent 39032877c3
commit 14bb954ddf
No known key found for this signature in database
GPG Key ID: 70CB8A85BA1633CB

@ -1,5 +1,6 @@
import os import os
import json_stream import json_stream
from base64 import b64decode
from typing import Iterator from typing import Iterator
@ -72,6 +73,8 @@ class HarFlowWrapper:
def get_response_body(self): def get_response_body(self):
if 'response' in self.flow and 'content' in self.flow['response'] and 'text' in self.flow['response']['content']: if 'response' in self.flow and 'content' in self.flow['response'] and 'text' in self.flow['response']['content']:
if 'encoding' in self.flow['response']['content'] and self.flow['response']['content']['encoding'] == 'base64':
return b64decode(self.flow['response']['content']['text']).decode()
return self.flow['response']['content']['text'] return self.flow['response']['content']['text']
return None return None

Loading…
Cancel
Save