(self, updated)
| 28 | ) |
| 29 | |
| 30 | def configure(self, updated): |
| 31 | if "modify_body" in updated: |
| 32 | self.replacements = [] |
| 33 | for option in ctx.options.modify_body: |
| 34 | try: |
| 35 | spec = parse_modify_spec(option, True) |
| 36 | except ValueError as e: |
| 37 | raise exceptions.OptionsError( |
| 38 | f"Cannot parse modify_body option {option}: {e}" |
| 39 | ) from e |
| 40 | |
| 41 | self.replacements.append(spec) |
| 42 | |
| 43 | stream_and_modify_conflict = ( |
| 44 | ctx.options.modify_body |
| 45 | and ctx.options.stream_large_bodies |
| 46 | and ("modify_body" in updated or "stream_large_bodies" in updated) |
| 47 | ) |
| 48 | if stream_and_modify_conflict: |
| 49 | logger.log( |
| 50 | ALERT, |
| 51 | "Both modify_body and stream_large_bodies are active. " |
| 52 | "Streamed bodies will not be modified.", |
| 53 | ) |
| 54 | |
| 55 | def request(self, flow): |
| 56 | if flow.response or flow.error or not flow.live: |
nothing calls this directly
no test coverage detected