$ show r-lib/httr
The httr package is an R library for making HTTP requests. It provides functions for the main HTTP verbs (GET, POST, PUT, DELETE, PATCH, HEAD) and a generic VERB function for custom verbs. It includes comprehensive support for HTTP configuration (authentication, headers, cookies, proxies, timeouts, etc.) and OAuth 1.0 and 2.0 authentication. Responses are captured in a response object and can be accessed as raw bytes, text, or parsed into common formats (JSON, XML, HTML, etc.). The package also includes utilities for URL parsing and building, media type parsing, HTTP date handling, retry logic with exponential backoff, and HTTP caching. Note: This package is superseded by httr2 for new development, but is still maintained for CRAN compatibility.
The LLM identified 3 files worth highlighting for reuse:
Implements parsing and formatting of HTTP dates according to RFC 2616. Handles the three valid date formats: RFC 822, RFC 850, and ANSI C's asctime. Self-contained with no internal dependencies, making it easily reusable in other projects requiring HTTP date handling.
Parses media types (MIME types) according to RFC 2616. Extracts type, subtype, and parameters from a media type string. Depends only on trivial string helper functions, making it easy to extract and reuse in other projects that need to process HTTP content types.
Provides robust parsing and building of URLs according to RFC 3986. Includes functions parse_url, build_url, and modify_url. Handles edge cases such as default ports, userinfo, and query parameters. Only depends on trivial string helpers and the external curl package for URL unescaping, making it a highly reusable component for URL manipulation.