Skip to content

Commit

Permalink
Apply the filter expression correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Nov 30, 2023
1 parent c33096e commit 07716f6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/addons/status_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ def configure(self, updates):
self.reset()
return
self.config = ctx.options.statuscode
print(f"statuscode will return HTTP {self.config['return_status']} filter={self.config.get('filter', {})}")
new_filter = self.config.get('filter', None)
print(f"statuscode will return HTTP {self.config['return_status']} filter={new_filter}")
if new_filter:
self.filter = flowfilter.parse(new_filter)
else:
self.filter = self.matchall

def response(self, flow):
# always ignore the controller
Expand All @@ -43,5 +48,3 @@ def response(self, flow):
return # ignore responses if we aren't told a code
if flowfilter.match(self.filter, flow):
flow.response = Response.make(self.config["return_status"])
else:
print("flow does not match filter")

0 comments on commit 07716f6

Please sign in to comment.