Skip to content

Releases: r-lib/httr2

httr2 1.1.2

26 Mar 12:48
Compare
Choose a tag to compare
  • req_headers() more carefully checks its input types (#707).
  • Fix AWS request signing due to argument 'cache' is missing error (#706, @jcheng5).

httr2 1.1.1

08 Mar 17:43
Compare
Choose a tag to compare

New features

  • req_perform_parallel() lifts many of the previous restrictions. It supports simplified versions of req_throttle() and req_retry(), can refresh OAuth tokens, and checks the cache before/after each request. (#681).
  • Default verbosity can be controlled by the HTTR2_VERBOSITY environment variable (#687).
  • local_verbosity() matches the existing with_verbosity() and allows for local control of verbosity (#687).
  • req_dry_run() and req_verbose() display compressed correctly (#91, #656) and automatically prettify JSON bodies (#668). You can suppress prettification with options(httr2_pretty_json = FALSE) (#668).
  • req_throttle() implements a new "token bucket" algorithm that maintains average rate limits while allowing bursts of higher request rates.

Minor improvements and bug fixes

  • aws_v4_signature() correctly processes URLs containing query parameters (@jeffreyzuber, #645).
  • oauth_client() and oauth_token() implement improved print methods with bulleted lists, similar to other httr2 objects, and oauth_client() with custom auth functions no longer produces errors (#648).
  • req_dry_run() omits headers that would vary in tests and can prettify JSON output.
  • req_headers() automatically redacts Authorization headers (#649) and correctly implements case-insensitive modification of existing headers (#682).
  • req_headers_redacted() now supports dynamic dots (#647).
  • req_oauth_auth_code() no longer adds trailing "/" characters to properly formed redirect_uri values (@jonthegeek, #646).
  • req_perform_connection() produces more helpful error messages when requests fail at the networking level.
  • req_perform_parallel(pool) now is deprecated in favour of a new max_active argument (#681).
  • req_user_agent() memoizes the default user agent to improve performance, as computing version numbers is relatively slow (300 µs).
  • resp_link_url() once again respects the case insensitivity for header names (@DavidRLovell, #655).
  • resp_stream_sse() automatically retrieves the next event when the current event contains no data, and returns data as a single string (#650).
  • str() correctly redacts redacted headers (#682).

httr2 1.1.0

20 Jan 13:42
Compare
Choose a tag to compare

Lifecycle changes

  • req_perform_stream() is superseded in favor of req_perform_connection(),
    which is no longer experimental (#625).

  • with_mock() and local_mock() are defunct and will be removed in the next
    release.

New features

  • is_online() wraps curl::has_internet(), making it easy to tell if you're
    currently online (#512).

  • req_headers_redacted() makes it easier to redact sensitive headers (#561).

  • req_retry() implements "circuit breaking", which immediatelys error after
    multiple failures to the same server (e.g. because the server is down)
    (#370).

  • req_url_relative() navigates to a relative URL (#449).

  • resp_request() returns the request associated with a response; this can
    be useful when debugging (#604).

  • resp_stream_is_complete() checks if data remains in the stream (#559).

  • url_modify(), url_modify_query(), and url_modify_relative() modify
    URLs (#464); url_query_parse() and url_query_build() parse and build
    query strings (#425).

Bug fixes and minor improvements

  • OAuth response parsing errors now have a dedicated httr2_oauth_parse error
    class that includes the original response object (@atheriel, #596).

  • curl_translate() converts cookie headers to req_cookies_set() (#431)
    and JSON data to req_body_json_modify() calls (#258).

  • print.request() escapes {} in headers (#586).

  • req_auth_aws_v4() formats the AWS Authorization header correctly (#627).

  • req_retry() defaults to max_tries = 2 when nethier max_tries nor
    max_seconds is set. If you want to disable retries, set max_tries = 1.

  • req_perform_connection() gains a verbosity argument, which is useful for
    understanding exactly how data is streamed back to you (#599).
    req_perform_promise() also gains a verbosity argument.

  • req_url_query() can control how spaces are encoded with .space (#432).

  • resp_link_url() handles multiple Link headers (#587).

  • resp_stream_sse() will warn if it recieves a partial event.

  • url_parse() parses relative URLs with new base_url argument (#449) and
    the uses faster and more correct curl::curl_parse_url() (#577).

httr2 1.0.7

27 Nov 14:17
Compare
Choose a tag to compare
  • req_perform_promise() upgraded to use event-driven async based on waiting efficiently on curl socket activity (#579).
  • New req_oauth_token_exchange() and oauth_flow_token_exchange() functions implement the OAuth token exchange protocol from RFC 8693 (@atheriel, #460).

httr2 1.0.6

04 Nov 18:00
Compare
Choose a tag to compare
  • Fix stochastic test failure, particularly on CRAN (#572)
  • New oauth_cache_clear() is an exported end point to clear the OAuth cache.
  • New req_auth_aws_v4() signs request using AWS's special format (#562, #566).
  • req_cache() no longer retrieves anything but GET requests from the cache.
  • New resp_stream_aws() to retrieve AWS's special streaming format. With thanks to https://github.com/lifion/lifion-aws-event-stream/ for a simple reference implementation.

httr2 1.0.5

26 Sep 12:34
Compare
Choose a tag to compare
  • req_perform_parallel() and req_perform_promise() now correctly set up the method and body (#549).

httr2 1.0.4

16 Sep 13:58
Compare
Choose a tag to compare
  • req_body_file() now works with files >64kb once more (#524) and no longer leaks a connection if the response doesn't complete succesfully (#534).
  • req_body_*() now give informative error if you attempt to change the body type (#451).
  • req_cache() now re-caches the response if the body is hasn't been modified but the headers have changed (#442). It also works better when req_perform() sets a path (#442).
  • New req_cookie_set() allows you to set client side cookies (#369).
  • req_perform() no longer displays a progress bar when sleeping during tests. You can override this behaviour by setting the option httr2_progress.
  • req_perform_iterative() is no longer experimental.
  • New req_perform_connection() for working with streaming data. Unlike req_perform_stream() which uses callbacks, req_perform_connection() returns a regular response object with a connection as the body. Unlike req_perform_stream() it supports req_retry() (with @jcheng5, #519).
  • req_retry() no longer treates low-level HTTP failures the same way as transient errors by default. You can return to the previous behaviour with retry_on_error = TRUE.
  • resp_body_html() and resp_body_xml() now work when req_perform() is given a path (#448).
  • New resp_stream_bytes(), resp_stream_lines(), and resp_stream_sse() for streaming chunk from a connection response (#519).

httr2 1.0.3

22 Aug 13:07
Compare
Choose a tag to compare
  • jwt_encode_hmac() now calls correct underlying function
    jose::jwt_encode_hmac() and has correct default size parameter value
    (@denskh, #508).

  • req_cache() now prunes cache before checking if a given key exists,
    eliminating the occassional error about reading from an invalid RDS file.
    It also no longer tests for existence then later reads the cache, avoiding
    potential race conditions.

  • New req_perform_promise() creates a promises::promise so a request can
    run in the background (#501, @gergness).

  • req_perform_parallel() now respects error handling in req_error().

httr2 1.0.2

16 Jul 12:22
Compare
Choose a tag to compare
  • req_body_file() now only opens a connection when the request actually needs data. In particular, this makes it work better with req_perform_parallel() (#487).
  • req_cache() no longer fails if the rds files are somehow corrupted and now defaults the debug argument to the httr2_cache_debug option to make it easier to debug caching buried in other people's code (#486).
  • req_oauth_password() now only asks for your password once (#498).
  • req_perform_parallel() now works correctly with req_cache() (#447) and now works when downloading 0 byte files (#478)
  • req_perform_stream() no longer applies the callback to unsuccessful
    responses, instead creating a regular response. It also now sets last_request() and last_response() (#479).
  • req_url_query() now allows you to opt out of escaping for multi-value parameters (#404).

httr2 1.0.1

01 Apr 21:13
Compare
Choose a tag to compare
  • req_perform_stream() gains a round = c("byte", "line") argument to control
    how the stream is rounded (#437).

  • req_retry() gives a clearer error if after returns the wrong type of
    value (#385).

  • req_template() now works when you have a bare : in a template that
    uses "uri" style (#389).

  • req_timeout() now resets the value of connecttimeout set by curl.
    This ensures that you can use req_timeout() to increase the connection
    timeout past 10s (#395).

  • url_parse() is considerably faster thanks to performance optimisations
    by and discussion with @DyfanJones (#429).