Closed sckott closed 4 years ago
pseudo-code
x <- HttpClient$new('https://httpbin.org/get?foo=bar')
maybe methods like $raise_for_status()
, but for the most common content types
x$raise_for_ct_xml() # == text/xml
x$raise_for_ct_json() # == application/json
x$raise_for_ct_html() # == text/html
where you could choose to stop or warn
x$raise_for_ct_json(condition = "warning") # options: stop, warning
or you could pass any string to customize the match
x$raise_for_ct("application/vnd.citationstyles.csl+json")
via https://github.com/ropensci/pangaear/issues/68 - seems like a method on the
HttpResponse
could be helpful to check response content types: