PowerShell
PowerShell
Inspect HTTP Request Header
Demonstrates theLastHeader property.
Chilkat PowerShell Downloads
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$success = $false
$http = New-Object Chilkat.Http
$url = "https://chilkatsoft.com/echo_request_body.asp"
$json = "{`"greeting`":`"Hello World`"}"
# Send a POST with the JSON in the HTTP request body.
$resp = New-Object Chilkat.HttpResponse
$success = $http.HttpStr("POST",$url,$json,"utf-8","application/json",$resp)
if ($success -eq $false) {
$($http.LastErrorText)
exit
}
# Examine the HTTP request header we just sent.
$($http.LastHeader)
# Output:
# POST /echo_request_body.asp HTTP/1.1
# Host: chilkatsoft.com
# Accept: */*
# Accept-Encoding: gzip
# Content-Type: application/json
# Content-Length: 26