Skip to main content

Request():head()

Send a HEAD request: the server answers with the same headers as GET, but without the body.

Signature​

head(): Response

Returns

Response - The response headers and status code; getData() is empty.

Description​

Use HEAD to check whether a resource exists, its content type, size or last-modified date without downloading it. Headers and parameters set on the Request are sent as usual.

Example​

local response = Request("https://api.example.com/file.zip"):head()
if response:getResponseCode() == 200 then
toast("Size: " .. response:getHeader("Content-Length"))
end

Compatible Version: 1.0.0.37 and up