Swift
Swift
Example: Http.HttpNoBody method
Demonstrates how to use the HttpNoBody method to send HTTP requests without a request body (e.g., GET, DELETE, HEAD) and receive the response in a Chilkat Http response object.Chilkat Swift Downloads
func chilkatTest() {
var success: Bool = false
let http = CkoHttp()!
let resp = CkoHttpResponse()!
// Send a DELETE request to https://api.example.com/users/123
var url: String? = "https://api.example.com/users/123"
success = http.httpNoBody(verb: "DELETE", url: url, response: resp)
if success == false {
print("\(http.lastErrorText!)")
return
}
print("Response Status Code: \(resp.statusCode.intValue)")
print("Response body:")
print("\(resp.bodyStr!)")
}