MCPcopy
hub / github.com/mitmproxy/mitmproxy / encode

Method encode

mitmproxy/addons/core.py:220–239  ·  view source on GitHub ↗

Encode flows with a specified encoding.

(
        self,
        flows: Sequence[flow.Flow],
        part: str,
        encoding: str,
    )

Source from the content-addressed store, hash-verified

218 @command.command("flow.encode")
219 @command.argument("encoding", type=mitmproxy.types.Choice("flow.encode.options"))
220 def encode(
221 self,
222 flows: Sequence[flow.Flow],
223 part: str,
224 encoding: str,
225 ) -> None:
226 """
227 Encode flows with a specified encoding.
228 """
229 updated = []
230 for f in flows:
231 p = getattr(f, part, None)
232 if p:
233 current_enc = p.headers.get("content-encoding", "identity")
234 if current_enc == "identity":
235 f.backup()
236 p.encode(encoding)
237 updated.append(f)
238 ctx.master.addons.trigger(hooks.UpdateHook(updated))
239 logger.log(ALERT, "Encoded %s flows." % len(updated))
240
241 @command.command("flow.encode.options")
242 def encode_options(self) -> Sequence[str]:

Callers 15

test_encodingFunction · 0.95
edit_focusMethod · 0.45
renderMethod · 0.45
truncated_plainFunction · 0.45
colorize_hostFunction · 0.45
colorize_reqFunction · 0.45
__init__Method · 0.45
_json_dumpsMethod · 0.45
eFunction · 0.45
YFunction · 0.45
always_bytesFunction · 0.45
check_passwordMethod · 0.45

Calls 5

backupMethod · 0.80
triggerMethod · 0.80
getMethod · 0.45
appendMethod · 0.45
logMethod · 0.45

Tested by 1

test_encodingFunction · 0.76