Learn R Programming

httr (version 1.4.4)

http_type: Extract the content type of a response

Description

Extract the content type of a response

Usage

http_type(x)

Value

A string giving the complete mime type, with all parameters stripped off.

Arguments

x

A response

Examples

Run this code
r1 <- GET("http://httpbin.org/image/png")
http_type(r1)
headers(r1)[["Content-Type"]]

r2 <- GET("http://httpbin.org/ip")
http_type(r2)
headers(r2)[["Content-Type"]]

Run the code above in your browser using DataLab