Send HEAD request to a URL

http:head(STRING url) : ARRAY

# note: you can use this function to quickly get information about the response without the time consuming part to get the body.

http:head('https://status.sunsed.com')
#=> [
#=>     "body" => "",
#=>     "header" => [
#=>         "Expires" => "Wed, 02 Oct 2019 18:02:58 GMT",
#=>         "Cache-Control" => "public",
#=>         "Content-Type" => "application/json",
#=>         "X-Cloud-Trace-Context" => "b16d3f98712174209eac459b4ddde6c4;o=1",
#=>         "Date" => "Wed, 02 Oct 2019 18:00:59 GMT",
#=>         "Server" => "Google Frontend",
#=>         "Transfer-Encoding" => "chunked"
#=>     ],
#=>     "info" => [
#=>         "url" => "https://status.sunsed.com/",
#=>         "content_type" => "application/json",
#=>         "header_size" => 265,
#=>         "request_size" => 57,
#=>         "ssl_verify_result" => FALSE,
#=>         "redirect_count" => 0,
#=>         "total_time" => 0.497651,
#=>         "namelookup_time" => 0.060852,
#=>         "connect_time" => 0.062564,
#=>         "pretransfer_time" => 0.148715,
#=>         "size_upload" => 0.0,
#=>         "size_download" => 0.0,
#=>         "speed_download" => 0.0,
#=>         "speed_upload" => 0.0,
#=>         "download_content_length" => -1.0,
#=>         "upload_content_length" => -1.0,
#=>         "redirect_time" => 0.0,
#=>         "redirect_url" => "",
#=>         "primary_ip" => "172.217.214.121",
#=>         "certinfo" => [],
#=>         "primary_port" => 443,
#=>         "http_version" => 2,
#=>         "protocol" => 2,
#=>         "scheme" => "HTTPS"
#=>     ],
#=>     "http_status_code" => 200,
#=>     "ok?" => TRUE
#=> ]

#=== 
http:head('https://status.g.com')
#=> ERROR: domain_not_whitelisted -- The domain name (g.com) is not whitelisted on SunSed. Contact support and request the domain to be whitelisted.

Copyright ©2013-2022 SunSed®. All rights reserved.