Skip to content

Commit

Permalink
Ensure optional addon values are set
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Jan 19, 2024
1 parent b6b812b commit a051c51
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/mitmproxy_addons/status_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def configure(self, updates):
self.reset()
return
self.config = ctx.options.statuscode
# ensure optional fields are set
self.config.setdefault("count", 0)
self.config.setdefault("block_request", False)

new_filter = self.config.get('filter', None)
print(f"statuscode will return HTTP {self.config['return_status']} filter={new_filter} count={self.config['count']}")
if new_filter:
Expand Down

0 comments on commit a051c51

Please sign in to comment.