Skip to content

Instantly share code, notes, and snippets.

@ctigeek
Created September 16, 2016 18:32
Show Gist options
  • Save ctigeek/b069efafbebc0731fffcf830b4653947 to your computer and use it in GitHub Desktop.
Save ctigeek/b069efafbebc0731fffcf830b4653947 to your computer and use it in GitHub Desktop.
Clean up after Invoke-RestMethod after PUT or DELETE.
$baseUrl = "https://blah.com"
$servicePoint = [System.Net.ServicePointManager]::FindServicePoint($baseUrl)
$url = "$baseUrl/blah/blah/blah"
Invoke-RestMethod -Uri $url -Method Delete -ErrorAction Stop
##without this cleanup, the above line will stop working after two calls
$ServicePoint.CloseConnectionGroup("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment