Merge pull request #94 from vbanos/json-compact

Send more compact JSON to browser
This commit is contained in:
Noah Levitt 2018-02-21 09:53:16 -08:00 committed by GitHub
commit b438cdd33e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,7 +228,7 @@ class WebsockReceiverThread(threading.Thread):
self.websock.send(
json.dumps(dict(
id=0, method='Page.handleJavaScriptDialog',
params={'accept': accept})))
params={'accept': accept}), separators=',:'))
def _handle_message(self, websock, json_message):
message = json.loads(json_message)
@ -315,7 +315,7 @@ class Browser:
def send_to_chrome(self, suppress_logging=False, **kwargs):
msg_id = next(self._command_id)
kwargs['id'] = msg_id
msg = json.dumps(kwargs)
msg = json.dumps(kwargs, separators=',:')
logging.log(
brozzler.TRACE if suppress_logging else logging.DEBUG,
'sending message to %s: %s', self.websock, msg)