Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ARAH/ARAH.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RootModule = 'ARAH.psm1'

# Version number of this module.
ModuleVersion = '1.3.8'
ModuleVersion = '1.5.1'

# ID used to uniquely identify this module
GUID = '5bf61bed-a3da-4550-949a-a869b8dc29c6'
Expand All @@ -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
Expand Down
33 changes: 26 additions & 7 deletions ARAH/changelog.md
Original file line number Diff line number Diff line change
@@ -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
- Initial release of the module.
12 changes: 9 additions & 3 deletions ARAH/functions/Invoke-ARAHRequest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
[string]$RequestModifier,
[string]$PagingHandler,
[switch]$ConvertJsonAsHashtable,
[hashtable]$Headers,
[switch]$EnablePaging
)
$uri = $connection.webServiceRoot + $path
Expand All @@ -110,17 +111,22 @@
$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("?")
}
$restAPIParameter = @{
Uri = $Uri
method = $Method
Headers = $connection.headers
Headers = $connection.headers.clone()
ContentType = $effectiveContentType
WebSession = $connection.WebSession
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 ',')"
Expand Down Expand Up @@ -154,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
Expand Down
1 change: 1 addition & 0 deletions ARAH/internal/classes/ARAHConnection.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[String]$ServerRoot
[String]$WebServiceRoot
[String]$AuthenticatedUser
[version]$HttpVersion="1.1"
hidden[PSCredential]$Credential
hidden[String]$ContentType
hidden[Microsoft.PowerShell.Commands.WebRequestSession]$WebSession
Expand Down
Loading