* web: Reduce FlowTable Redux subscriptions from O(rows) to O(1)
Lift shared state (displayColumnNames, flowIndex) from per-row/per-cell
useAppSelector calls to the FlowTable parent component. This eliminates
N identical Redux subscriptions across all visible rows.
Changes:
- FlowTable.tsx: Fetch displayColumnNames from state.options.web_columns
in mapStateToProps; pass as prop to FlowRow along with flowIndex.
- FlowRow.tsx: Accept displayColumnNames and flowIndex as props instead
of useAppSelector. Remove unused useAppSelector import.
- FlowColumns.tsx: Accept optional flowIndex prop in index column;
use it instead of per-cell useAppSelector(_listIndex).
- FlowTableHead.tsx: Add null guard on displayColumnNames for
edge-case during initial state hydration.
- FlowRowSpec.tsx: Update test to pass new required props.
* [autofix.ci] apply automated fixes
* fix: pass flowIndex prop in FlowColumnsSpec snapshot test
The index column now uses flowIndex prop instead of
useAppSelector. Pass flowIndex={0} in the generic column
render loop so the snapshot matches the expected numeric
output.
* address review feedback: rename flowIndex to rowNumber, remove defensive guards
- Rename flowIndex → rowNumber per reviewer suggestion
- Make rowNumber required in FlowColumnProps (never undefined)
- Remove unnecessary || [] null guard in FlowTableHead
- Read displayColumnNames from test store instead of hardcoding
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [autofix.ci] apply automated fixes
* fix: use list position (not view position) for # column
rowNumber now comes from _listIndex (insertion order) instead of
vScroll.start + idx (view position). This preserves the original
behavior where the # column shows the flow's arrival order regardless
of sorting or filtering.
Added test to verify index column displays rowNumber + 1.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [autofix.ci] apply automated fixes
* docs: add CHANGELOG entry for FlowTable optimization
* [autofix.ci] apply automated fixes
---------
Co-authored-by: Ariel <ariel@captaintech.io>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
* fix(web): allow clearing body content to empty in editor
The body editor's save function used `editedContent || content || ""`
which treats empty string as falsy, falling back to the original body
content. This makes it impossible to clear a body to empty via the
Edit button — the save always sends the original content.
Changed to `editedContent ?? content ?? ""` so that only `undefined`
(user didn't edit) falls back, while empty string is sent as-is.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* [autofix.ci] apply automated fixes
* test: move body edit tests into HttpMessageSpec.tsx
Move the two body-edit tests from the separate HttpMessageEditSpec.tsx
into HttpMessageSpec.tsx as requested in review. The CodeEditor mock is
now file-scoped, which simplifies the edit-mode snapshot (CodeMirror DOM
replaced by a lightweight textarea stub).
* Update CHANGELOG.md
Co-authored-by: Matteo Luppi <100372313+lups2000@users.noreply.github.com>
* test: use conditional CodeEditor mock to preserve snapshot
Use a mockUseCodeEditor flag so the real CodeEditor renders by default
(keeping the existing snapshot unchanged) and only the body-edit tests
switch to the textarea mock. Rename CVD → cvd for consistency.
* [autofix.ci] apply automated fixes
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Matteo Luppi <100372313+lups2000@users.noreply.github.com>
* Partially Revert "Web: harden `xsrf_token` usage (#7491)"
This reverts commit b761cb46c4.
The reason for this revert is that it's incompatible with Vite's
server (https://github.com/mitmproxy/mitmproxy/issues/7969).
We keep the parts that are compatible, and add an additional
`Sec-Fetch-Site` check for for all requests.
* use type imports for Vite compatibility
* make flow columns work with function name minification
* make modals work with function name minification
* vite: move assets
* web: switch builds to vite
* move to vite
* vite: move css and js
* update CHANGELOG
* [autofix.ci] apply automated fixes
* fix test failures
* fix static viewer
* obtain xsrf cookie lazily
* split js/css bundles into app/vendor
* [autofix.ci] apply automated fixes
* update compiled assets
* fix nits
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* feat: Make TCP inactivity timeout configurable (currently fixed at 10 minutes) #7909
* docs: updated CHANGELOG
* [autofix.ci] apply automated fixes
* fix: add tests
* fix: testcase
* fix nits:
- We currently only add command line flags for the most important options. `--set tcp_timeout=10` is the recommended approach for now.
- Move timeout to the "wait for close" part specifically.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
* remove tabs.isInitial
this was not used in the first place
* fix docs links
* fix headerlookup
WeakMap allows us to finally have proper cache invalidation
* store capture tab in url state
* Add new feature: storing of request and response streaming bodies
* Fix unit test by regenerating the options file with options_js.py
* Add test cases with store_streamed_bodies True and False
* Update Changelog
* Update Changelog with pull request ID
* [autofix.ci] apply automated fixes
* Update test with a dedicated test case for store_streamed_bodies
* Remove unnecessary option store_streamed_bodies from options.py
* Update docstrings for store_streamed_bodies and stream_large_bodies.
* Update docstring for store_streamed_bodies since it is not used anywhere in practice here.
* Fix typo in test_http.py
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* create ui component for copying content
* write function to copy viewcontentdata to clipboard
* add type string to url
* call the endpoint to fetch the full content
* update snapshots
* disable button after copying text
* update changelog
* remove disable on copy button
* [autofix.ci] apply automated fixes
* disable copy button while fetching
* [autofix.ci] apply automated fixes
* adjust isFetching and isCopied position
* hide copy button if there is no content
* update snapshot
* Delete web/src/templates/index.html
* adjust naming convention
* update test
* update snapshots
* nits
* add async/await
* [autofix.ci] apply automated fixes
* improve test coverage
* improve even more test coverage
* test coverage final improvement
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>