Skip to content

Commit ae68666

Browse files
committed
Add _method and use always post with multipart/form-data
1 parent 7945896 commit ae68666

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

SnipeitPS/Private/Invoke-SnipeitMethod.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,15 @@
6161
ErrorAction = 'SilentlyContinue'
6262
}
6363

64-
#Place holder for intended image manipulation
64+
# Place holder for intended image manipulation
6565
# if and when snipe it API gets support for images
6666
if($null -ne $body -and $Body.Keys -contains 'image' ){
6767
if($PSVersionTable.PSVersion -ge '7.0'){
6868
$Body['image'] = get-item $body['image']
69+
# As multipart/form-data is always POST we need add
70+
# requested method for laravel named as '_method'
71+
$Body['_method'] = $Method
72+
$splatParameters["Method"] = 'POST'
6973
$splatParameters["Form"] = $Body
7074
} else {
7175
# use base64 encoded images for powershell version < 7

0 commit comments

Comments
 (0)