Merge pull request #219 from PetriAsi/fix/content-encoding#218

Fix/content encoding #218 introduced on 1.9 release
This commit is contained in:
Petri Asikainen 2021-09-03 15:56:56 +03:00 committed by GitHub
commit 44fb65ca60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 3 deletions

View file

@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/),
and this project adheres to [Semantic Versioning](http://semver.org/).
# [v.1.10.x] - 2021-09-03
## New secure ways to connect Snipe it
### -secureApiKey allow pass apiKey as SecureString
Connect-SnipeitPS -URL 'https://asset.example.com' -secureApiKey 'tokenKey'
### Set connection with safely saved credentials, first save credentials
$SnipeCred= Get-Credential -message "Use url as username and apikey as password"
$SnipeCred | Export-CliXml snipecred.xml
### ..then use your saved credentials like
Connect-SnipeitPS -siteCred (Import-CliXml snipecred.xml)
## Fix for content encoding in invoke-snipeitmethod
Version 1.9 introduced bug that converted non ascii characters to ascii
during request.
# [v.1.9.x] - 2021-07-14
## Image uploads

View file

@ -19,9 +19,23 @@ Install-Module SnipeitPS
# Check for updates occasionally:
Update-Module SnipeitPS
# To use each session:
# import module to session:
Import-Module SnipeitPS
Set-SnipeitInfo -URL 'https://asset.example.com' -apiKey 'tokenKey'
# Set connection
Connect-SnipeitPS -URL 'https://asset.example.com' -apiKey 'tokenKey'
# Or set connection with safely saved credentials, first save credentials
$SnipeCred =Get-Credential -message "Use url as username and apikey as password"
$SnipeCred | Export-CliXml snipecred.xml
# ..then use your saved credentials like
Connect-SnipeitPS -siteCred (Import-CliXml snipecred.xml)
# OR use -secureApiKey that allow pass apiKey as SecureString
# if you are usin Microsoft.PowerShell.SecretManagement or like
Connect-SnipeitPS -URL 'https://asset.example.com' -secureApiKey 'tokenKey'
```
### Usage

View file

@ -103,7 +103,7 @@ function Invoke-SnipeitMethod {
}
if ($Body -and $splatParameters.Keys -notcontains 'Form') {
$splatParameters["Body"] = $Body | Convertto-Json
$splatParameters["Body"] = [System.Text.Encoding]::UTF8.GetBytes(($Body | Convertto-Json))
}
$script:PSDefaultParameterValues = $global:PSDefaultParameterValues