Skip to content

Comments

feat: add HarRecorder PSR-18 client decorator for recording HTTP traffic#245

Merged
deviantintegral merged 6 commits intomainfrom
claude/har-response-recorder-8941f
Jan 15, 2026
Merged

feat: add HarRecorder PSR-18 client decorator for recording HTTP traffic#245
deviantintegral merged 6 commits intomainfrom
claude/har-response-recorder-8941f

Conversation

@deviantintegral
Copy link
Owner

@deviantintegral deviantintegral commented Jan 14, 2026

Implement a PSR-18 HTTP client decorator that records request/response pairs to HAR format. This enables generating test fixtures by recording real API interactions.

Example usage:

    $recorder = new HarRecorder($actualHttpClient);
    $response = $recorder->sendRequest($request);
    $har = $recorder->getHar();

Features:

  • Records timing information for each request
  • Supports custom creator name/version
  • Provides entry count and reset functionality
  • Fully serializable HAR output

…ffic

Implement a PSR-18 HTTP client decorator that records request/response
pairs to HAR format. This enables generating test fixtures by recording
real API interactions.

Core methods:
- sendRequest(): delegates to inner client and records the entry
- getHar(): returns recorded traffic as a HAR object
- getEntries(): returns individual recorded entries
Add count() method to get the number of recorded entries.
Add clear() method to remove all recorded entries.
@deviantintegral deviantintegral force-pushed the claude/har-response-recorder-8941f branch 2 times, most recently from ad3931b to 4fa626c Compare January 15, 2026 17:52
Remove getEntries() method - callers can use getHar()->getLog()->getEntries()
instead. This simplifies the API by having a single way to access entries.
Remove count() method - callers can use count($recorder->getHar()->getLog()->getEntries())
instead. This simplifies the API.
Rename clear() method to reset() for clearer semantics.
@deviantintegral deviantintegral force-pushed the claude/har-response-recorder-8941f branch from 4fa626c to 7dbcff3 Compare January 15, 2026 18:24
@deviantintegral deviantintegral marked this pull request as ready for review January 15, 2026 18:35
@deviantintegral deviantintegral merged commit c32600d into main Jan 15, 2026
13 checks passed
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.

2 participants