mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
- Adds -Form Parameter to Invoke-WebRequest and Invoke-RestMethod. - Form Accepts any IDictionary. - Keys are used as multipart/form-data field names (PSObject unwrapped and ConvertTo<String>(Object)). - FileInfo values are added as StreamContent with application/octet-stream content type and the FileInfo.Name as the file name. - Strings are treated as StringContent. - Singe values are converted to string with ConvertTo<String>(Object) and treated as StringContent - Top level collections are enumerated and converted as above. Nested collections are treated as a single value and converted accordingly. - Form is mutually exclusive with -Body and -InFile. - Per PowerShell-Committee decision, -Form makes no assumptions about the HTTP method used. It can theoretically be used with any method. User will need to manually supply -Method POST to post the form. - ContentType and content related headers supplied to -Headers will be ignored/cleared as MultipartFormDataContent requires control of these headers.
Testing
The tests are organized by testing language. Thus Pester tests, which are written in the PowerShell language, are in ./powershell and xUnit tests, written in C#, are in ./csharp. The sanity tests for the Full .NET build of PowerShell are in ./fullclr, and the third-party shebang test is in ./shebang.