Skip to content

Commit

Permalink
For trigger events, only build the resulting chromewhip hash from the…
Browse files Browse the repository at this point in the history
… hashable fields in the actual payload.
  • Loading branch information
chazkii committed Jan 20, 2018
1 parent e62b213 commit 02f8357
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions chromewhip/chrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,12 @@ async def _send(self, request, recv_validator=None, input_event_cls=None, trigge

if trigger_event_cls:
try:
hash_ = trigger_event_cls.build_hash(**hash_input_dict)
# TODO: put in a `strict` flag so that we can catch differences between the protocol spec and the
# underlying implementation.
cleaned_hash_input_dict = {k: v for k, v in hash_input_dict.items() if k in trigger_event_cls.hashable}
hash_ = trigger_event_cls.build_hash(**cleaned_hash_input_dict)
except TypeError:
raise TypeError('Event "%s" hash cannot be built with "%s"' % trigger_event_cls.js_name, hash_input_dict)
raise TypeError(f'Event "{trigger_event_cls.js_name}" hash cannot be built with "{hash_input_dict}"')
event = self._event_payloads.get(hash_)
if not event:
self._send_log.debug('Waiting for event with hash "%s"...' % hash_)
Expand Down

0 comments on commit 02f8357

Please sign in to comment.