Sample code for 30+ languages & platforms
Go

Example: Http.HasRequestHeader method

Demonstrates the HasRequestHeader method.

Chilkat Go Downloads

Go
    http := chilkat.NewHttp()

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

    b := http.HasRequestHeader("X-CSRF-Token")
    if b == true {
        fmt.Println("X-CSRF-Token: Yes")
    } else {
        fmt.Println("X-CSRF-Token: No")
    }

    b = http.HasRequestHeader("X-Something")
    if b == true {
        fmt.Println("X-Something: Yes")
    } else {
        fmt.Println("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 == true {
        fmt.Println("Accept: Yes")
    } else {
        fmt.Println("Accept: No")
    }

    // Output:

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

    http.DisposeHttp()