From c9f9db71b5fed39e7b290dc90d4227d0fdb26b8d Mon Sep 17 00:00:00 2001 From: Callidus2000 <73584079+Callidus2000@users.noreply.github.com> Date: Wed, 24 Jul 2024 15:23:05 +0200 Subject: [PATCH 1/6] Depth added to ConvertTo-Json v1.3.8 --- ARAH/functions/Invoke-ARAHRequest.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ARAH/functions/Invoke-ARAHRequest.ps1 b/ARAH/functions/Invoke-ARAHRequest.ps1 index 38a42f8..dea15fc 100644 --- a/ARAH/functions/Invoke-ARAHRequest.ps1 +++ b/ARAH/functions/Invoke-ARAHRequest.ps1 @@ -110,7 +110,7 @@ $SkipCheckAndValidation = ($SkipCheck + $Connection.SkipCheck) | Select-Object -Unique if ($URLParameter) { Write-PSFMessage "Converting UrlParameter to a Request-String and add it to the path" -Level Debug - Write-PSFMessage "$($UrlParameter| ConvertTo-Json -WarningAction SilentlyContinue)" -Level Debug + Write-PSFMessage "$($UrlParameter| ConvertTo-Json -WarningAction SilentlyContinue -Depth 3)" -Level Debug $parameterString = (Get-ARAHEncodedParameterString($URLParameter)) $uri = $uri + '?' + $parameterString.trim("?") } From 8653e37fb2a8f66c53befcdc35367959e58e1455 Mon Sep 17 00:00:00 2001 From: Callidus2000 <73584079+Callidus2000@users.noreply.github.com> Date: Fri, 4 Oct 2024 12:58:19 +0200 Subject: [PATCH 2/6] Support for newer HTTP-Versions added --- ARAH/ARAH.psd1 | 4 ++-- ARAH/functions/Invoke-ARAHRequest.ps1 | 1 + ARAH/internal/classes/ARAHConnection.ps1 | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ARAH/ARAH.psd1 b/ARAH/ARAH.psd1 index 1d881f2..4a78789 100644 --- a/ARAH/ARAH.psd1 +++ b/ARAH/ARAH.psd1 @@ -3,7 +3,7 @@ RootModule = 'ARAH.psm1' # Version number of this module. - ModuleVersion = '1.3.8' + ModuleVersion = '1.4.0' # ID used to uniquely identify this module GUID = '5bf61bed-a3da-4550-949a-a869b8dc29c6' @@ -26,7 +26,7 @@ # Modules that must be imported into the global environment prior to importing # this module RequiredModules = @( - @{ ModuleName = 'PSFramework'; ModuleVersion = '1.6.214' } + @{ ModuleName = 'PSFramework'; ModuleVersion = '1.11.343' } ) # Assemblies that must be loaded prior to importing this module diff --git a/ARAH/functions/Invoke-ARAHRequest.ps1 b/ARAH/functions/Invoke-ARAHRequest.ps1 index dea15fc..ebbbe82 100644 --- a/ARAH/functions/Invoke-ARAHRequest.ps1 +++ b/ARAH/functions/Invoke-ARAHRequest.ps1 @@ -121,6 +121,7 @@ ContentType = $effectiveContentType WebSession = $connection.WebSession Credential = $connection.Credential + HttpVersion = $Connection.HttpVersion } if ($SkipCheckAndValidation.Count -gt 0) { Write-PSFMessage "Skipping the following checks during http request: $($SkipCheckAndValidation|Join-String ',')" diff --git a/ARAH/internal/classes/ARAHConnection.ps1 b/ARAH/internal/classes/ARAHConnection.ps1 index 915f056..ecb7354 100644 --- a/ARAH/internal/classes/ARAHConnection.ps1 +++ b/ARAH/internal/classes/ARAHConnection.ps1 @@ -5,6 +5,7 @@ [String]$ServerRoot [String]$WebServiceRoot [String]$AuthenticatedUser + [version]$HttpVersion="1.1.0" hidden[PSCredential]$Credential hidden[String]$ContentType hidden[Microsoft.PowerShell.Commands.WebRequestSession]$WebSession From 6a236519e05dbaae14d2a01a2fde653ca96132cc Mon Sep 17 00:00:00 2001 From: Callidus2000 <73584079+Callidus2000@users.noreply.github.com> Date: Tue, 25 Feb 2025 17:50:23 +0100 Subject: [PATCH 3/6] v1.5.0 -Change to RequestModifier Execution -Ability to add Headers to a request added --- ARAH/ARAH.psd1 | 2 +- ARAH/functions/Invoke-ARAHRequest.ps1 | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ARAH/ARAH.psd1 b/ARAH/ARAH.psd1 index 4a78789..60c3d9b 100644 --- a/ARAH/ARAH.psd1 +++ b/ARAH/ARAH.psd1 @@ -3,7 +3,7 @@ RootModule = 'ARAH.psm1' # Version number of this module. - ModuleVersion = '1.4.0' + ModuleVersion = '1.5.0' # ID used to uniquely identify this module GUID = '5bf61bed-a3da-4550-949a-a869b8dc29c6' diff --git a/ARAH/functions/Invoke-ARAHRequest.ps1 b/ARAH/functions/Invoke-ARAHRequest.ps1 index ebbbe82..b2453f2 100644 --- a/ARAH/functions/Invoke-ARAHRequest.ps1 +++ b/ARAH/functions/Invoke-ARAHRequest.ps1 @@ -96,6 +96,7 @@ [string]$RequestModifier, [string]$PagingHandler, [switch]$ConvertJsonAsHashtable, + [hashtable]$Headers, [switch]$EnablePaging ) $uri = $connection.webServiceRoot + $path @@ -123,6 +124,10 @@ Credential = $connection.Credential HttpVersion = $Connection.HttpVersion } + if ($Headers){ + Write-PSFMessage "Adding additional headers: $($Headers|ConvertTo-Json -Compress)" + $restAPIParameter.Headers += $Headers + } if ($SkipCheckAndValidation.Count -gt 0) { Write-PSFMessage "Skipping the following checks during http request: $($SkipCheckAndValidation|Join-String ',')" $SkipCheckAndValidation | ForEach-Object { $restAPIParameter."Skip$_" = $true } @@ -155,7 +160,7 @@ try { If ($RequestModifier) { [PSFScriptBlock]$reqModifierScript = Get-PSFScriptBlock -Name $RequestModifier - $reqModifierScript.InvokeEx($false, $true, $true) + $reqModifierScript.InvokeEx($false, $true, $false) } Write-ARAHCallMessage $restAPIParameter $response = Invoke-WebRequest @restAPIParameter From 6f6408e402a5f8c27d352dba5dfd4328aafd2533 Mon Sep 17 00:00:00 2001 From: Callidus2000 <73584079+Callidus2000@users.noreply.github.com> Date: Wed, 26 Feb 2025 14:11:05 +0100 Subject: [PATCH 4/6] Headers are cloned --- ARAH/functions/Invoke-ARAHRequest.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ARAH/functions/Invoke-ARAHRequest.ps1 b/ARAH/functions/Invoke-ARAHRequest.ps1 index b2453f2..e908801 100644 --- a/ARAH/functions/Invoke-ARAHRequest.ps1 +++ b/ARAH/functions/Invoke-ARAHRequest.ps1 @@ -118,7 +118,7 @@ $restAPIParameter = @{ Uri = $Uri method = $Method - Headers = $connection.headers + Headers = $connection.headers.clone() ContentType = $effectiveContentType WebSession = $connection.WebSession Credential = $connection.Credential From 243c5bf6f075e1bdddd3782eda45e2d30b550e4e Mon Sep 17 00:00:00 2001 From: Callidus2000 <73584079+Callidus2000@users.noreply.github.com> Date: Tue, 29 Apr 2025 08:40:40 +0200 Subject: [PATCH 5/6] Update module version to 1.5.1 -Fixed HTTPversion from 1.1.0 to 1.1 as Powershell 7.5 complains otherwise --- ARAH/ARAH.psd1 | 2 +- ARAH/internal/classes/ARAHConnection.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ARAH/ARAH.psd1 b/ARAH/ARAH.psd1 index 60c3d9b..a9cc889 100644 --- a/ARAH/ARAH.psd1 +++ b/ARAH/ARAH.psd1 @@ -3,7 +3,7 @@ RootModule = 'ARAH.psm1' # Version number of this module. - ModuleVersion = '1.5.0' + ModuleVersion = '1.5.1' # ID used to uniquely identify this module GUID = '5bf61bed-a3da-4550-949a-a869b8dc29c6' diff --git a/ARAH/internal/classes/ARAHConnection.ps1 b/ARAH/internal/classes/ARAHConnection.ps1 index ecb7354..a919136 100644 --- a/ARAH/internal/classes/ARAHConnection.ps1 +++ b/ARAH/internal/classes/ARAHConnection.ps1 @@ -5,7 +5,7 @@ [String]$ServerRoot [String]$WebServiceRoot [String]$AuthenticatedUser - [version]$HttpVersion="1.1.0" + [version]$HttpVersion="1.1" hidden[PSCredential]$Credential hidden[String]$ContentType hidden[Microsoft.PowerShell.Commands.WebRequestSession]$WebSession From 48a8876d9e19d1130da7d31415dcc08b85c35acf Mon Sep 17 00:00:00 2001 From: Callidus2000 <73584079+Callidus2000@users.noreply.github.com> Date: Tue, 29 Apr 2025 09:03:24 +0200 Subject: [PATCH 6/6] Update changelog for version 1.5.1: fix HTTP version, enhance header cloning, and improve formatting --- ARAH/changelog.md | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/ARAH/changelog.md b/ARAH/changelog.md index 74d234d..e36d50a 100644 --- a/ARAH/changelog.md +++ b/ARAH/changelog.md @@ -1,13 +1,32 @@ # Changelog + +## 1.5.1 (2025-04-29) +- Fixed HTTP version from `1.1.0` to `1.1` as PowerShell 7.5 complains otherwise. +- Headers are now cloned. + +## 1.5.0 (2025-04-29) +- Changed RequestModifier execution. +- Added ability to add headers to a request. +- Support for newer HTTP versions added. + ## 1.3.8 (2023-09-08) - - If the result is JSON you can enable converting it to a HashTable with the `Invoke-ARAHRequest -ConvertJsonAsHashtable` switch. This is needed in case of the error `Cannot convert the JSON string because it contains keys with different casing. Please use the -AsHashTable switch instead.` - - File Downloads can be handled +- Depth parameter added to `ConvertTo-Json`. +- Added parameter help for `OutFile`. +- If the result is JSON, you can enable converting it to a HashTable with the `Invoke-ARAHRequest -ConvertJsonAsHashtable` switch. This is needed in case of the error `Cannot convert the JSON string because it contains keys with different casing. Please use the -AsHashTable switch instead.` +- File downloads can now be handled. + ## 1.3.6 (2023-03-03) - - If using a HashTable object for the `Invoke-ARAHRequest -Body` parameter it is only converted to json if the content type matches `json`. +- If using a HashTable object for the `Invoke-ARAHRequest -Body` parameter, it is only converted to JSON if the content type matches `json`. + ## 1.3.5 (2023-01-18) - - Added Parameter/Property SkipCheck to the ARAHConnection class and to Invoke-ARAHRequest - Allows e.g. to skip SSL checks while performing the HTTP requests +- Added `SkipCheck` parameter/property to the `ARAHConnection` class and `Invoke-ARAHRequest`. This allows skipping SSL checks while performing HTTP requests. + +## 1.3.4 +- Added configurable depth for `ConvertTo-Json` calls. +- Added `-WarningAction SilentlyContinue` to all `ConvertTo-Json` calls. + ## 1.1.0 (2021-02-26) - - New: automatic generation of functions based on swagger specs +- New: Automatic generation of functions based on Swagger specs. + ## 1.0.0 (2021-02-22) - - New: Module \ No newline at end of file +- Initial release of the module. \ No newline at end of file