Repository navigation
feat: Add support for HTTP response trailers - #2417
HosseinDinarvand wants to merge 1 commit into
Conversation
PR Summary by QodoExpose HTTP response trailers separately from other headers
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
|
Code Review by Qodo
1. Older targets return null for trailers
|
| /// <summary> | ||
| /// Trailer headers returned by server with the response | ||
| /// </summary> | ||
| public IReadOnlyCollection<HeaderParameter>? TrailingHeaders { get; set; } |
There was a problem hiding this comment.
1. Older targets return null for trailers 🐞 Bug ≡ Correctness
TrailingHeaders has no empty default, and its only assignment in GetDefaultResponse is excluded from non-NET builds. Successful responses on .NET Framework and .NET Standard therefore leave the property null, unlike modern targets, where responses without trailers expose an empty collection.
Agent Prompt
## Issue description
Successful responses on older targets leave `TrailingHeaders` null because their builds exclude its only assignment.
## Fix Focus Areas
- src/RestSharp/Response/RestResponseBase.cs[114-117]
- src/RestSharp/Response/RestResponse.cs[76-78]
## Recommended Fix
Initialize `TrailingHeaders` to an empty collection for targets without trailer support, while preserving the populated collection on supported targets.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
@dotnet-policy-service agree |



PR Classification
New feature and API enhancement for preserving HTTP trailer headers.
PR Summary
RestSharp now exposes HTTP response trailers separately from regular and content headers. Integration coverage verifies trailer preservation on .NET 8+.
RestResponse: MapsHttpResponseMessage.TrailingHeadersunderNETtargets.RestResponseBase: Adds nullableTrailingHeaderswith documentation.Related to #2413