Sample code for 30+ languages & platforms
PowerBuilder

Example: Http.HasRequestHeader method

Demonstrates the HasRequestHeader method.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Http
integer b

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Http.SetRequestHeader("X-CSRF-Token","Fetch")

b = loo_Http.HasRequestHeader("X-CSRF-Token")
if b = 1 then
    Write-Debug "X-CSRF-Token: Yes"
else
    Write-Debug "X-CSRF-Token: No"
end if

b = loo_Http.HasRequestHeader("X-Something")
if b = 1 then
    Write-Debug "X-Something: Yes"
else
    Write-Debug "X-Something: No"
end if

// The Accept and Accept-Encoding headers are default headers automatically added,
// unless the application chooses to remove by calling RemoveRequestHeader for each.
b = loo_Http.HasRequestHeader("Accept")
if b = 1 then
    Write-Debug "Accept: Yes"
else
    Write-Debug "Accept: No"
end if

// Output:

// X-CSRF-Token: Yes
// X-Something: No
// Accept: Yes


destroy loo_Http