MCPcopy
hub / github.com/mitmproxy/mitmproxy / getIcon

Function getIcon

web/src/js/flow/utils.ts:192–228  ·  view source on GitHub ↗
(flow: Flow)

Source from the content-addressed store, hash-verified

190export const canResumeOrKill = (flow: Flow): boolean => flow.intercepted;
191
192export const getIcon = (flow: Flow): string => {
193 if (flow.type !== "http") {
194 if (flow.client_conn.tls_version === "QUICv1") {
195 return `resource-icon-quic`;
196 }
197 return `resource-icon-${flow.type}`;
198 }
199 if (flow.websocket) {
200 return "resource-icon-websocket";
201 }
202 if (!flow.response) {
203 return "resource-icon-plain";
204 }
205
206 const contentType = ResponseUtils.getContentType(flow.response) || "";
207
208 if (flow.response.status_code === 304) {
209 return "resource-icon-not-modified";
210 }
211 if (300 <= flow.response.status_code && flow.response.status_code < 400) {
212 return "resource-icon-redirect";
213 }
214 if (contentType.indexOf("image") >= 0) {
215 return "resource-icon-image";
216 }
217 if (contentType.indexOf("javascript") >= 0) {
218 return "resource-icon-js";
219 }
220 if (contentType.indexOf("css") >= 0) {
221 return "resource-icon-css";
222 }
223 if (contentType.indexOf("html") >= 0) {
224 return "resource-icon-document";
225 }
226
227 return "resource-icon-plain";
228};
229
230export const mainPath = (flow: Flow): string => {
231 switch (flow.type) {

Callers 1

iconFunction · 0.90

Calls 1

getContentTypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…