◐ Shell
clean mode source ↗

Handle resume responses without Content-Range by KirtiRamchandani · Pull Request #27529 · PowerShell/PowerShell

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates PowerShell web cmdlets’ -Resume handling to tolerate non-compliant 416 RequestedRangeNotSatisfiable responses that omit Content-Range, treating them as “already complete”, and adds test coverage for this behavior.

Changes:

  • Add a WebListener endpoint that returns 416 without a Content-Range header when a Range request is made.
  • Refactor and harden resume-range handling in WebRequestPSCmdlet to avoid null dereferences and treat missing Content-Range as complete.
  • Add Pester tests for Invoke-WebRequest and Invoke-RestMethod validating the new -Resume behavior.

Reviewed changes

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

File Description
test/tools/WebListener/Controllers/ResumeController.cs Adds a new test endpoint to simulate 416 without Content-Range for range requests
test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 Adds regression tests for -Resume behavior when Content-Range is missing
src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs Refactors resume logic into helpers and treats missing Content-Range as “already complete”