MCPcopy
hub / github.com/mitmproxy/mitmproxy / copy

Function copy

web/src/js/flow/export.ts:4–22  ·  view source on GitHub ↗
(flow: Flow, format: string)

Source from the content-addressed store, hash-verified

2import type { Flow } from "../flow";
3
4export const copy = async (flow: Flow, format: string): Promise<void> => {
5 // Safari: We need to call copyToClipboard _right away_ with a promise,
6 // otherwise we're loosing user intent and can't copy anymore.
7 const formatted = (async () => {
8 const ret = await runCommand("export", format, `@${flow.id}`);
9 if (ret.value) {
10 return ret.value;
11 } else if (ret.error) {
12 throw ret.error;
13 } else {
14 throw ret;
15 }
16 })();
17 try {
18 await copyToClipboard(formatted);
19 } catch (err) {
20 alert(err);
21 }
22};

Callers 1

ExportButtonFunction · 0.90

Calls 2

runCommandFunction · 0.90
copyToClipboardFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…