Skip to content

feat(debug): log body, headers and params for sdk api calls - #502

Merged
FreekVR merged 4 commits into
mainfrom
fix/log-headers-body-and-params-for-sdkapi
Jul 9, 2026
Merged

feat(debug): log body, headers and params for sdk api calls#502
FreekVR merged 4 commits into
mainfrom
fix/log-headers-body-and-params-for-sdkapi

Conversation

@FreekVR

@FreekVR FreekVR commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

adds additional debug information to the myparcel debug logs for any API calls made through the sdk

Copilot AI review requested due to automatic review settings July 9, 2026 13:38
@FreekVR
FreekVR requested a review from a team as a code owner July 9, 2026 13:38
@github-project-automation github-project-automation Bot moved this to Todo in PDK Jul 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds richer debug logging around SDK API traffic by including request/response details (body, headers, and query params) in the existing transport-layer logging middleware.

Changes:

  • Log outgoing request body (JSON-decoded), headers, and query parameters in Sending API request debug logs.
  • Log response headers in Received API response debug logs (in addition to status and decoded body).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/SdkApi/Middleware/LoggingMiddleware.php
Comment thread src/SdkApi/Middleware/LoggingMiddleware.php Outdated
Comment thread src/SdkApi/Middleware/LoggingMiddleware.php Outdated
@myparcel-bot myparcel-bot Bot added the approved (Auto) label Jul 9, 2026
@myparcel-bot
myparcel-bot Bot force-pushed the fix/log-headers-body-and-params-for-sdkapi branch from f3b6b4f to b14ffeb Compare July 9, 2026 14:18
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.26%. Comparing base (ae28336) to head (805f07c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #502   +/-   ##
=========================================
  Coverage     94.25%   94.26%           
- Complexity     2350     2354    +4     
=========================================
  Files           350      350           
  Lines          7538     7547    +9     
=========================================
+ Hits           7105     7114    +9     
  Misses          433      433           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

FreekVR and others added 4 commits July 9, 2026 18:00
Casting the request body to a string for logging advanced the stream
pointer to EOF. For request bodies larger than the curl handler's
in-memory threshold this could send an empty or partial body downstream.
Rewind after logging, mirroring the response path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…field

Add assertions for the request body, request headers and response
headers logging (including scrubbing/masking). Remove the params field:
Guzzle folds the query option into the URI and unsets it from options
before the handler stack runs, so it was always empty — the query
string is already logged (scrubbed) as part of the uri field.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
scrubArray only masked scalar leaves whose own key was sensitive, so a
sensitive key holding an array leaked its values (e.g.
['token' => ['secret']] stayed unmasked). Carry a forceMask flag down
the recursion: once a key matches, every value beneath it is masked
regardless of child key names, while structure is preserved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@FreekVR
FreekVR force-pushed the fix/log-headers-body-and-params-for-sdkapi branch from c59d12d to 805f07c Compare July 9, 2026 16:00
@FreekVR
FreekVR enabled auto-merge July 9, 2026 16:00
@FreekVR
FreekVR added this pull request to the merge queue Jul 9, 2026
Merged via the queue into main with commit 3b5a1db Jul 9, 2026
13 checks passed
@FreekVR
FreekVR deleted the fix/log-headers-body-and-params-for-sdkapi branch July 9, 2026 16:14
@github-project-automation github-project-automation Bot moved this from Todo to Done in PDK Jul 9, 2026
myparcel-bot Bot added a commit that referenced this pull request Jul 9, 2026
## [4.3.0](v4.2.1...v4.3.0) (2026-07-09)

### ✨ New Features

* **debug:** log body, headers and params for sdk api calls ([#502](#502)) ([3b5a1db](3b5a1db))
@myparcel-bot

myparcel-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 4.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@myparcel-bot myparcel-bot Bot added the released label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants