(PowerShell) Example: Http.HasRequestHeader method
Demonstrates the HasRequestHeader method.
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$http = New-Object Chilkat.Http
$http.SetRequestHeader("X-CSRF-Token","Fetch")
$b = $http.HasRequestHeader("X-CSRF-Token")
if ($b -eq $true) {
$("X-CSRF-Token: Yes")
}
else {
$("X-CSRF-Token: No")
}
$b = $http.HasRequestHeader("X-Something")
if ($b -eq $true) {
$("X-Something: Yes")
}
else {
$("X-Something: No")
}
# The Accept and Accept-Encoding headers are default headers automatically added,
# unless the application chooses to remove by calling RemoveRequestHeader for each.
$b = $http.HasRequestHeader("Accept")
if ($b -eq $true) {
$("Accept: Yes")
}
else {
$("Accept: No")
}
# Output:
# X-CSRF-Token: Yes
# X-Something: No
# Accept: Yes
|