We are using SP2016 on-premise. In order to handle security test I prepared a PowerShell script to test upload with PUT/POST.
$Digest = $response.getcontextwebinformation.FormDigestValue $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" $Headers.Add("accept","application/json;odata=verbose") $Headers.Add("X-RequestDigest",$Digest) Invoke-WebRequest -method Post -UseDefaultCredentials -uri $url -InFile $uploadPath -headers $Headers By using above script I can upload my file successfully. Return status code is 200.
Then I change the -method to PUT. The file STILL upload successfully. However the status code return is
Remote server returned an error: (400) Bad Request
Is it normal SharePoint behavior? Why SharePoint allow file upload while returning 400 error? Is it possible we can disallow PUT on SharePoint?