Major differences between httr and httr2
mainIf you are migrating from httr, note these key architectural changes:
- Request/Response Separation: In
httr2, you create and modify request objects independently before performing them.req_perform()replaces the individualhttr::GET(),httr::POST(), etc., functions. - Error Handling: HTTP errors (4xx and 5xx) are automatically converted into R errors. You can use
req_error()to customize this behavior. - Built-in Retries:
req_retry()provides native support for automatic retries on transient failures. - Enhanced OAuth: The OAuth implementation has been overhauled to support more flows and easier customization.
- Secret Management: Includes tools like
secret_encrypt()for managing credentials andobfuscate()for protecting sensitive data in code.