Skip to content

feat(network): HAR / cURL Export (#3) - #404

Merged
maatheusgois-dd merged 3 commits into
mainfrom
feature/har-curl-export
Jul 18, 2026
Merged

maatheusgois-dd merged 3 commits into
mainfrom
feature/har-curl-export

Conversation

@maatheusgois-dd

Copy link
Copy Markdown
Contributor

Feature #3 — HAR / cURL Export

Implements the HAR / cURL Export feature from docs/PROPOSED_FEATURES.md.

What

  • Multi-select network captures → export as HAR 1.2 JSON or a cURL command string.
  • Sensitive headers (Authorization, Cookie, Set-Cookie) are redactable.

Why testable

The entire feature is data transformation — no URLSession, no network. A captured request/response struct maps to a JSON dictionary (HAR) or a string (cURL). Redaction is a dictionary map. All pure Swift.

Files

  • DebugSwift/Sources/Features/Network/Models/HARExport.swift — Foundation-only core (HAREncoder, HARCapture, HARRequest, HARResponse).
  • DebugSwift/Sources/Features/Network/Helpers/HARExportAdapter.swift — UIKit adapter bridging HttpModelHARCapture and wiring FileSharingManager/UIPasteboard.

Tested contracts (local, standalone SPM package)

  • HAREncoder.encode([capture])[String: Any] with log.version == "1.2", correct request.method/url.
  • HAREncoder.curlCommand(for:)curl -X METHOD 'url' -H 'k: v' -d 'body'.
  • HAREncoder.redactHeaders(_:) → replaces Authorization/Cookie/Set-Cookie with <redacted>, leaves others intact.

Result: 3 tests, 0 failures (verified locally via a throwaway SPM package; DebugSwift itself is UIKit-only and cannot build on macOS, per the doc's testability filter).

Integration into DebugSwift

HttpModelHARCapture via HARExportAdapter.capture(from:). Add toolbar items to the existing network history list; share via FileSharingManager.generateFileAndShare.

Co-authored-by: oh-my-pi https://omp.sh

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Messages
📖 Project coverage: 51.06%
📖 The PR added 490 and removed 17 lines. 4 file(s) changed.

ExampleTests.xctest: Coverage: 97.17

File Coverage
HARExportTests.swift 97.49%

Generated by 🚫 Danger Swift against 9c80bbb

@maatheusgois-dd maatheusgois-dd self-assigned this Jul 16, 2026
Add a Foundation-only HAR 1.2 encoder, cURL command builder, and header
redaction logic, plus a UIKit adapter bridging `HttpModel` to the pure
`HARCapture` shape and wiring export through `FileSharingManager`.

The core is fully testable without a simulator (3 tests, 0 failures in a
standalone SPM package), as specified in docs/PROPOSED_FEATURES.md.

Co-authored-by: oh-my-pi <https://omp.sh>
@maatheusgois-dd
maatheusgois-dd force-pushed the feature/har-curl-export branch from 8bf94dc to 9c80bbb Compare July 16, 2026 20:58
@maatheusgois-dd
maatheusgois-dd merged commit 1107929 into main Jul 18, 2026
5 checks passed
@maatheusgois-dd
maatheusgois-dd deleted the feature/har-curl-export branch July 18, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant