MCPcopy
hub / github.com/mitmproxy/mitmproxy / get

Method get

mitmproxy/tools/web/app.py:506–528  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

504
505class DumpFlows(RequestHandler):
506 def get(self) -> None:
507 self.set_header("Content-Disposition", "attachment; filename=flows")
508 self.set_header("Content-Type", "application/octet-stream")
509
510 match: Callable[[mitmproxy.flow.Flow], bool]
511 try:
512 match = flowfilter.parse(self.request.arguments["filter"][0].decode())
513 except ValueError: # thrown py flowfilter.parse if filter is invalid
514 raise APIError(400, f"Invalid filter argument / regex")
515 except (
516 KeyError,
517 IndexError,
518 ): # Key+Index: ["filter"][0] can fail, if it's not set
519
520 def match(_) -> bool:
521 return True
522
523 with BytesIO() as bio:
524 fw = io.FlowWriter(bio)
525 for f in self.view:
526 if match(f):
527 fw.add(f)
528 self.write(bio.getvalue())
529
530 async def post(self):
531 self.view.clear()

Callers

nothing calls this directly

Calls 7

addMethod · 0.95
APIErrorClass · 0.85
matchFunction · 0.85
getvalueMethod · 0.80
parseMethod · 0.45
decodeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected