From ae68666bbd34f7fc482a403cbe43a6fa0230beb9 Mon Sep 17 00:00:00 2001 From: Petri Asikainen Date: Wed, 14 Jul 2021 13:01:56 +0300 Subject: [PATCH] Add _method and use always post with multipart/form-data --- SnipeitPS/Private/Invoke-SnipeitMethod.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SnipeitPS/Private/Invoke-SnipeitMethod.ps1 b/SnipeitPS/Private/Invoke-SnipeitMethod.ps1 index 8e9ac84..4f8f26d 100644 --- a/SnipeitPS/Private/Invoke-SnipeitMethod.ps1 +++ b/SnipeitPS/Private/Invoke-SnipeitMethod.ps1 @@ -61,11 +61,15 @@ ErrorAction = 'SilentlyContinue' } - #Place holder for intended image manipulation + # Place holder for intended image manipulation # if and when snipe it API gets support for images if($null -ne $body -and $Body.Keys -contains 'image' ){ if($PSVersionTable.PSVersion -ge '7.0'){ $Body['image'] = get-item $body['image'] + # As multipart/form-data is always POST we need add + # requested method for laravel named as '_method' + $Body['_method'] = $Method + $splatParameters["Method"] = 'POST' $splatParameters["Form"] = $Body } else { # use base64 encoded images for powershell version < 7