Skip to content

Fixes bug in har responses encoding#1693

Open
waldekmastykarz wants to merge 2 commits into
dotnet:mainfrom
waldekmastykarz:fix-har-encoding
Open

Fixes bug in har responses encoding#1693
waldekmastykarz wants to merge 2 commits into
dotnet:mainfrom
waldekmastykarz:fix-har-encoding

Conversation

@waldekmastykarz

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings June 6, 2026 13:40
@waldekmastykarz waldekmastykarz requested a review from a team as a code owner June 6, 2026 13:40

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

This PR addresses incorrect encoding when exporting HTTP bodies (notably in HAR generation and DevTools inspection) by centralizing body-to-string decoding and honoring Content-Type charset when provided.

Changes:

  • Introduces a shared HttpUtils.GetBodyString helper to decode request/response bodies using Content-Type charset or a UTF-8 fallback.
  • Updates DevToolsPlugin to use the shared decoding helper instead of its local implementation.
  • Updates HarGeneratorPlugin to decode bodies via the helper and to report body/content sizes based on raw byte length.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
DevProxy.Plugins/Utils/HttpUtils.cs Adds a shared body decoding helper to standardize charset handling across plugins.
DevProxy.Plugins/Inspection/DevToolsPlugin.cs Replaces local body decoding with the shared helper for request/response body capture.
DevProxy.Plugins/Generation/HarGeneratorPlugin.cs Uses shared decoding for HAR text fields and switches HAR size fields to byte-based lengths.

Comment thread DevProxy.Plugins/Utils/HttpUtils.cs
@waldekmastykarz waldekmastykarz added the pr-bugfix Fixes a bug label Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants