http_error: Check for an http error.

Description Usage Arguments Value See Also Examples

View source: R/response-status.r

Description

Check for an http error.

Usage

1

Arguments

x

Object to check. Default methods are provided for strings (which perform an HEAD() request), responses, and integer status codes.

...

Other arguments passed on to methods.

Value

TRUE if the request fails (status code 400 or above), otherwise FALSE.

See Also

Other response methods: content, http_status, response, stop_for_status

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# You can pass a url:
http_error("http://www.google.com")
http_error("http://httpbin.org/status/404")

# Or a request
r <- GET("http://httpbin.org/status/201")
http_error(r)

# Or an (integer) status code
http_error(200L)
http_error(404L)

r-lib/httr documentation built on Dec. 17, 2018, 1:44 a.m.