Skip to content

Commit

Permalink
Some cleanup and changing UserAgent to use initialized variable instead
Browse files Browse the repository at this point in the history
Including UseBasicParsing to avoid Internet Explorer not being initalized
  • Loading branch information
bsquidwrd committed May 19, 2021
1 parent bd2bdb4 commit 1c3dda8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions AeriesApi/Methods/Base/Invoke-AeriesApiCall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ function Invoke-AeriesApiCall
}

# Basic variables to be used when sending the request
$UserAgent = "PowerShell AeriesApi Module"
$RequestURL = "$($AeriesConfig.URL)/api/$Endpoint"
$BaseURL = $AeriesConfig.URL.Trim("/")
$RequestURL = "$BaseURL/api/$Endpoint"

# Begin Parameter processing
# Check if a DatabaseYear was configured
# If so, add to parameters except when asked to ignore
if (![string]::IsNullOrWhiteSpace($AeriesConfig.DatabaseYear) -and !$IgnoreDatabaseYear) {
$QueryParameters += @{
"DatabaseYear" = $AeriesConfig.DatabaseYear
"DatabaseYear" = $AeriesConfig.DatabaseYear.Trim()
}
}

Expand All @@ -95,7 +95,8 @@ function Invoke-AeriesApiCall
Uri = $RequestURL;
Method = $Method;
Headers = $Headers;
UserAgent = $UserAgent;
UserAgent = $AeriesConfig.UserAgent;
UseBasicParsing = $true;
}

# Sending a body when it's not Put or Post doesn't work for Invoke-WebRequest
Expand Down

0 comments on commit 1c3dda8

Please sign in to comment.