R/response-type.R
http_type.Rd
Extract the content type of a response
http_type(x)
A response
A string giving the complete mime type, with all parameters stripped off.
r1 <- GET("http://httpbin.org/image/png") http_type(r1)#> [1] "image/png"headers(r1)[["Content-Type"]]#> [1] "image/png" r2 <- GET("http://httpbin.org/ip") http_type(r2)#> [1] "application/json"headers(r2)[["Content-Type"]]#> [1] "application/json"