Ruby
Ruby
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 Ruby Downloads
require 'chilkat'
success = false
http = Chilkat::CkHttp.new()
resp = Chilkat::CkHttpResponse.new()
# Send a DELETE request to https://api.example.com/users/123
url = "https://api.example.com/users/123"
success = http.HttpNoBody("DELETE",url,resp)
if (success == false)
print http.lastErrorText() + "\n";
exit
end
print "Response Status Code: " + resp.get_StatusCode().to_s() + "\n";
print "Response body:" + "\n";
print resp.bodyStr() + "\n";