Conversation
Removed the acceptEncodings parameter from AddHttpClientWithResilience and related calls, using a static internal list ("br", "gzip") instead. This ensures consistent Accept-Encoding headers and simplifies the API. Updated all usages and removed redundant variables.
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
Adds Brotli/Gzip response compression to the ASP.NET Core APIs and centralizes outgoing Accept-Encoding + automatic decompression for HttpClient registrations in the DataEngine.
Changes:
- Enabled ASP.NET Core response compression middleware (Brotli + Gzip) in both DataEngine and TestPlugin.
- Added a centralized
AcceptEncodingslist and appliedAccept-Encodingheaders to resilientHttpClientregistrations. - Enabled automatic decompression (Brotli/Gzip) on the primary
HttpClientHandlerfor resilient clients.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
source/AAS.TwinEngine.Plugin.TestPlugin/Program.cs |
Adds response compression services + middleware to the TestPlugin API pipeline. |
source/AAS.TwinEngine.DataEngine/Program.cs |
Adds response compression services + middleware to the DataEngine API pipeline. |
source/AAS.TwinEngine.DataEngine/Infrastructure/Http/Extensions/HttpClientRegistrationExtensions.cs |
Centralizes Accept-Encoding headers and enables automatic decompression for resilient HttpClient registrations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…aders for HttpClient
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Centralize and encapsulate logic for configuring HTTP client Accept-Encoding headers and decompression methods. Introduce helper methods for setting headers and creating handlers, improving code clarity and maintainability. Remove redundant static fields and streamline decompression method selection using LINQ.
Removed explicit inclusion of "application/problem+json" and "application/problem+xml" from the response compression middleware. The middleware now uses only the default MIME types provided by ResponseCompressionDefaults.MimeTypes.
…/AAS-TwinEngine/AAS.TwinEngine.DataEngine into feature/614-Response-Compression
…i and Gzip providers
Move response compression setup to a dedicated extension method for improved modularity. Simplify HttpClient compression handling by configuring Accept-Encoding headers and automatic decompression inline, and remove redundant helper methods. This results in cleaner and more maintainable server and client compression configuration.
Removed two tests from HttpClientRegistrationExtensionsTests that verified Accept-Encoding headers and automatic decompression for GZip and Brotli in AddHttpClientWithoutResilience. No other changes were made to the class.
Added ResponseCompressionTests using Playwright to verify Data Engine's handling of response compression. Tests cover gzip, identity, and Brotli (br) encodings, ensuring correct Content-Encoding and Vary headers are returned based on client requests. Included a helper method for header extraction.
|
Test & Coverage ReportTest Results Summary
Code CoverageUnit Tests Coverage
Minimum allowed line rate is Module Tests Coverage
|



This PR introduces response compression support and simplifies HTTP client configuration by centralizing Accept‑Encoding logic.
Key Changes
Introduced a static internal list:
private static readonly IReadOnlyCollection<string> AcceptEncodings = ["br", "gzip"];All configured HttpClient instances now consistently apply:
Added automatic decompression in HttpClientHandler for: