Changelog

View Source

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased

[0.11.0] - 2026-07-04

Added

  • Added Fetch-style streaming response bodies by exposing the stream PID in response.body, while keeping response.stream as a compatibility alias.
  • Added HTTP/1.1 streaming request uploads with HTTP.Stream bodies and duplex: "half" chunked request framing.

Changed

  • Updated response helpers, docs, and e2e coverage for the new streamed body shape.
  • Return explicit unsupported errors for streaming request bodies on HTTP/2 and HTTP/3 instead of buffering or misframing them.

[0.10.0] - 2026-07-01

Added

  • Added independent http_web_socket, http_event_source, and http_web_transport umbrella apps with browser-like protocol APIs.
  • Added e2e coverage for EventSource, WebSocket, and WebTransport workflows.

Changed

  • Extracted shared HTTP primitives into the http_core app so protocol apps share common code without depending on http_fetch.
  • Updated CI, test, e2e, and release workflows to cover every umbrella app and publish all packages with one shared version.

[0.9.1] - 2026-06-23

Changed

  • Removed legacy :httpc compatibility option buckets from HTTP.fetch/2. Fetch init options are now flat, and redirects use redirect: :follow | :manual | :error.

Fixed

  • Validate response Transfer-Encoding framing instead of falling back to Content-Length for unsupported transfer codings.
  • Keep completed empty streams readable for late consumers.
  • Make the Unix socket e2e coverage independent of a host Docker daemon.
  • Align release metadata, README examples, and project guidance with the socket transport.

[0.9.0] - 2026-06-17

Changed

  • Replaced :httpc with the internal socket transport while preserving the default redirect-following behavior; pass autoredirect: false to return redirect responses.
  • Legacy :httpc options that are not implemented by the socket transport are documented as compatibility-only options.

[0.7.0] - 2025-01-XX

Added - Browser Fetch API Compatibility (~85% API Parity)

  • HTTP.StatusText module - Maps HTTP status codes to standard status text messages (60+ codes)
  • Response.status_text - Status message property (e.g., "OK", "Not Found")
  • Response.ok - Boolean property indicating success (true for 200-299 status codes)
  • Response.body_used - Tracks body consumption (field exists for API compatibility)
  • Response.redirected - Indicates if response was redirected
  • Response.type - Response type (:basic, :cors, :error, :opaque)
  • Response.new/1 - Constructor helper that auto-populates Browser API fields
  • Response.clone/1 - Clone response for multiple reads (buffers streaming responses)
  • Response.arrayBuffer/1 - Read body as binary (ArrayBuffer equivalent)
  • Response.array_buffer/1 - Snake_case alias for arrayBuffer
  • HTTP.Blob module - Blob struct with data, type, and size fields
  • Response.blob/1 - Read body as Blob with metadata (extracts MIME type from headers)
  • Comprehensive Browser API compatibility documentation in README
  • 41 new tests covering all Browser Fetch API features

Changed - Breaking Changes for Browser API Compatibility

  • Response struct fields added: status_text, ok, body_used, redirected, type
    • Migration: Update pattern matches to ignore new fields or use variable binding
    • Example: %Response{status: 200} = response (ignores new fields)
  • Response construction: All internal Response creation now uses Response.new/1
    • Ensures consistent Browser API field population
    • Migration: Use Response.new/1 instead of direct %Response{} for consistency
  • body_used field: Present for Browser API compatibility but doesn't enforce in Elixir
    • Due to Elixir's immutability, multiple reads of the same response value work
    • Use clone/1 for clarity when reading multiple times

Documentation

  • Added "Browser Fetch API Compatibility" section to README with examples
  • Documented Elixir-specific differences (immutability, synchronous returns, streams)
  • Updated all Response documentation to reflect new Browser API properties
  • Added comprehensive examples for clone/1, arrayBuffer/1, and blob/1

Notes

  • This release prioritizes Browser Fetch API compatibility over Elixir-specific patterns
  • The body_used field exists for API compatibility but cannot prevent multiple reads due to immutability
  • All critical Browser Fetch API Response properties and methods are now supported

[0.5.0] - 2025-08-01

Added

  • HTTP.Telemetry module - Complete telemetry integration for HTTP request monitoring
    • Request lifecycle events with rich metadata
    • Response body reading events for tracking download progress
    • Streaming events for real-time data transfer monitoring
    • Zero configuration integration with Elixir's :telemetry library

Changed

  • Updated default User-Agent string format to include library version 0.5.0
  • Enhanced telemetry event metadata with improved error reporting

[0.4.3] - 2025-08-01

Added

  • Added HTTP.Headers.set_default/3 method to set headers only if they don't already exist
    • Uses case-insensitive header name matching
    • Preserves existing headers when they already contain the specified name
  • Added automatic default User-Agent header to all HTTP requests
    • Format: Mozilla/5.0 (macOS; aarch64-apple-darwin24.3.0) OTP/27 BEAM/15.2.3 Elixir/1.18.3 http_fetch/0.4.3
    • Includes OS information, system architecture, OTP version, BEAM version, Elixir version, and library version
    • Uses dynamic version detection via Application.spec(:http_fetch, :vsn)
    • Preserves custom User-Agent headers when provided
  • Added HTTP.Headers.user_agent/0 method to access the default User-Agent string
  • Added comprehensive HTTP.Telemetry module for HTTP request metrics and monitoring
    • Request lifecycle events: [:http_fetch, :request, :start], [:http_fetch, :request, :stop], [:http_fetch, :request, :exception]
    • Response body reading events: [:http_fetch, :response, :body_read_start], [:http_fetch, :response, :body_read_stop]
    • Streaming events: [:http_fetch, :streaming, :start], [:http_fetch, :streaming, :chunk], [:http_fetch, :streaming, :stop]
    • Rich metadata: Includes URLs, HTTP status codes, response sizes, durations, and error reasons
    • Automatic integration: All HTTP.fetch operations automatically emit telemetry events
    • Zero configuration: Works out of the box with Elixir's :telemetry library

Changed

  • Enhanced User-Agent string to include system architecture information
  • Refactored User-Agent generation for consistency across the codebase
  • Updated default headers handling to use set_default/3 for better extensibility

[0.4.2] - 2025-08-01

Added

  • Added HTTP.Response.write_to/2 method to write response bodies to files
    • Supports both streaming and non-streaming responses
    • Automatically creates directories if they don't exist
    • Returns :ok or {:error, reason} for proper error handling

Fixed

  • Fixed streaming implementation message format for complete responses
  • Increased streaming threshold from 100KB to 5MB to prevent issues with large files
  • Fixed test assertion for content-length comparison using byte_size/1 instead of length/1

Changed

  • Updated streaming threshold to prevent streaming for files under 5MB
  • Improved streaming process error handling

[0.4.1] - 2025-07-31

Added

  • URI struct support - HTTP.fetch/2 now accepts both string URLs and %URI{} structs
  • Enhanced URL handling - Automatic conversion from string to %URI{} for internal processing
  • Type safety improvements - HTTP.Request and HTTP.Response now use %URI{} internally
  • Improved Request field naming - More intuitive field names for :httpc.request mapping

Changed

  • Refactored URL handling - All internal representations now use %URI{} instead of string
  • Updated type specifications - HTTP.Request.url type changed from String.t() | charlist() to URI.t()

  • Updated Response.url type - Changed from String.t() to URI.t()
  • Updated function signatures - handle_httpc_response and related functions now accept URI.t()
  • HTTP.Request field renaming for better clarity:
    • optionshttp_options (3rd argument to :httpc.request)
    • optsoptions (4th argument to :httpc.request)

Technical Details

  • Backward compatibility - String URLs are automatically parsed to URI structs
  • Consistent URI handling - All internal operations use parsed URI structs
  • Eliminated redundant parsing - Removed duplicate URI.parse calls in streaming functions
  • Enhanced type safety - Stronger typing throughout the codebase
  • Updated test suite - Request tests updated to use URI.parse/1 for consistency
  • Improved field documentation - Clear mapping to :httpc.request arguments

[0.4.0] - 2025-07-30

Added

  • HTTP.FetchOptions module - New dedicated module for processing fetch options with full httpc support
  • Enhanced option handling - Support for all :httpc.request options including timeout, SSL, streaming, etc.
  • Multiple input formats - Accept keyword lists, maps, or HTTP.FetchOptions struct
  • Complete httpc integration - Proper separation of HttpOptions and Options for :httpc.request
  • Type-safe configuration - Structured approach to HTTP request configuration
  • Comprehensive option coverage - All documented :httpc.request options supported
  • HTTP.FormData module - New dedicated module for handling form data and multipart/form-data encoding
  • File upload support - Support for file uploads with streaming via File.Stream.t()
  • Automatic content type detection - Automatically chooses between application/x-www-form-urlencoded and multipart/form-data
  • Streaming file uploads - Efficient large file uploads using Elixir streams
  • Form data builder API - Fluent interface with new/0, append_field/3, append_file/4-5
  • Multipart boundary generation - Automatic random boundary generation for multipart requests
  • Comprehensive test coverage - Full test suite for form data and fetch options functionality

Changed

  • HTTP.fetch refactored - Now uses HTTP.FetchOptions for consistent option processing
  • HTTP.Request body parameter - Now accepts HTTP.FormData.t() for form submissions
  • Enhanced content type handling - Automatic content-type detection and header setting
  • Improved multipart encoding - Proper multipart/form-data format with boundaries
  • Unified configuration API - All configuration goes through HTTP.FetchOptions

Technical Details

  • HTTP.FetchOptions struct with comprehensive field support for all httpc options
  • FormData struct with parts array for form fields and file uploads
  • Streaming support via File.Stream.t() for memory-efficient file uploads
  • URL encoding fallback for simple form data without file uploads
  • Backward compatibility maintained for existing string/charlist body usage

[0.3.0] - 2025-07-30

Fixed

  • HTTP option placement - Fixed body_format: :binary option being passed to wrong :httpc argument
  • Eliminated warning messages - Removed "Invalid option {body_format,binary} ignored" notices during tests
  • Improved error handling - Enhanced response handling for malformed URLs and network errors

Technical Details

  • Corrected httpc arguments - Proper separation of request options vs client options
  • Cleaned up streaming setup - Removed redundant option configurations
  • Enhanced test reliability - Reduced external dependency flakiness

[0.2.0] - 2025-07-30

Added

  • HTTP.Headers module - New dedicated module for HTTP header processing
  • Structured headers - HTTP.Request and HTTP.Response now use HTTP.Headers.t() struct
  • Header manipulation utilities - new/1, get/2, set/3, merge/2, delete/2, etc.
  • Header parsing - Content-Type parsing with media type and parameters extraction
  • Case-insensitive header access via HTTP.Headers.get/2 and HTTP.Response.get_header/2
  • Backward compatibility - HTTP.fetch still accepts list/map formats with auto-conversion

Changed

  • Refactored header storage from plain lists to HTTP.Headers struct
  • Enhanced type safety with proper struct types throughout the codebase
  • Updated Response API - Added get_header/2 and content_type/1 helper methods

Technical Details

  • New HTTP.Headers struct with comprehensive header manipulation capabilities
  • Immutable operations - All header operations return new struct instances
  • Automatic conversion - Input formats (list/map) auto-converted to struct
  • Enhanced documentation with examples for new header functionality
  • Maintained backward compatibility - Existing code continues to work

[0.1.0] - 2025-07-30

Added

  • Initial project setup with Mix
  • Basic project structure and configuration
  • Core HTTP fetch functionality
  • Response and Request struct definitions
  • Promise implementation for async operations
  • AbortController for request cancellation
  • Comprehensive test coverage
  • Documentation and README