-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Summary of the new feature / enhancement
Thanks to a contribution by @CarloToso, since v7.4.0 it has been possible to pass a directory rather than a file path to -OutFile, in which the web cmdlets use the (ultimate) target URL's last segment as the file name.
Given that, when redirections are involved, you won't know what that last segment is, being able to programmatically discover the resulting full download file path is important.
This will also apply to the planned support for using a server-suggested output file name via a Content-Disposition response header field - see PR #19385
(Using -Verbose is a way to discover the file name interactively; while it's technically possible to programmatically parse the verbose output, that would be both cumbersome and brittle).
Thus - at least when -OutFile is used - the [Microsoft.PowerShell.Commands.WebResponseObject] instance returned via -PassThru should have an .OutFile property or similar that reflects the output file's full path.
Related:
Proposed technical implementation details (optional)
I don't know whether it's worth extending [Microsoft.PowerShell.Commands.WebResponseObject] or not.
If not, an ETS NoteProperty member could be used.