generate functionWed, 01 Mar 2023

get contnet type from url

def content_type(url) url = URI.parse(url) Net::HTTP.start(url.host, url.port) do |http| return http.head(url.path)['Content-Type'] end end content_type(url)

Want to kickstart your project?Use the new AI Studio to create your code