Check for an http error.
http_error(x, ...)
| x | Object to check. Default methods are provided for strings
(which perform an |
|---|---|
| ... | Other arguments passed on to methods. |
TRUE if the request fails (status code 400 or above),
otherwise FALSE.
Other response methods:
content(),
http_status(),
response(),
stop_for_status()
# You can pass a url: http_error("http://www.google.com")#> [1] FALSEhttp_error("http://httpbin.org/status/404")#> [1] TRUE#> [1] FALSE# Or an (integer) status code http_error(200L)#> [1] FALSEhttp_error(404L)#> [1] TRUE