Sample code for 30+ languages & platforms
Swift

Example: Http.GetRequestHeader method

Demonstrates the GetRequestHeader method.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let http = CkoHttp()!

    var hdr1: String? = "X-CSRF-Token"
    var hdr2: String? = "X-Example"

    http.setRequestHeader(name: hdr1, value: "Fetch")
    http.setRequestHeader(name: hdr2, value: "123ABC")

    print("\(hdr1!): \(http.getRequestHeader(name: hdr1)!)")
    print("\(hdr2!): \(http.getRequestHeader(name: hdr2)!)")

    // Output:

    // X-CSRF-Token: Fetch
    // X-Example: 123ABC

}