go_http 0.2.0
go_http: ^0.2.0 copied to clipboard
Reliable HTTP client for Dart — built for control, cancellation and consistency.
Changelog #
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.
0.2.0 - 2026-07-12 #
Fixed #
- Timeouts now actually work:
connectTimeout/sendTimeout/receiveTimeoutare enforced per phase on native (dart:io) and as an overall request timeout on web. Exceeding a timeout throwsTimeoutError(previously these options were silently ignored). - Web binary responses:
WebTransportnow readsresponseType = 'arraybuffer', so binary data (images, gzipped bodies, files) is no longer corrupted. - Multi-value
Set-Cookie: cookies withExpires/multiple headers are parsed correctly (no longer split on the comma insideExpires). TheDomainattribute is honored for subdomain matching. - Error interceptors now run exactly once per attempt (previously twice for HTTP errors).
- Auth refresh retry:
AuthInterceptornow retries the request once after refreshing the token on401(previously refreshed but never retried). - Dead redirect code removed;
followRedirects/maxRedirectsare now wired into the IO transport. - Header keys normalized to lowercase in both transports for case-insensitive lookups.
IoTransportno longer mutates a caller-suppliedHttpClient.
Added #
RetrySignalcontrol-flow type returned by interceptors to request a bounded retry.Decoder<T>support (decoder:parameter) on all request methods for real type-safe decoding.ProgressCallback(onReceiveProgress:) on all request methods, with byte progress on native and web.- Convenience methods:
put,delete,patch,head,options. - Injectable
Loggersink forLoggingInterceptorandConsoleMetricsSink. maxAuthRetriesoption onGoHttpClient.queryParametersfromRequestOptionsare now applied to the request URI.
Changed #
- Retry backoff switched to stateless exponential backoff with equal jitter (AWS-recommended; safe to share a single policy across concurrent requests). Previously claimed "decorrelated jitter" but implemented a different, stateful algorithm.
CancellationTokenevent delivery is now synchronous (instant listener notification).
Tests #
- Added comprehensive test suite: retry policy, cookie store, cancellation, decoders, and client flow (retries, auth refresh, cancellation, error-interceptor cardinality, decoders, query params, convenience methods) via a fake transport.
0.1.1 - 2025-11-13 #
Added #
- Basic example (
example/main.dart) for pub.dev package validation - Makefile with development commands for code analysis, formatting, running examples, and version management
0.1.0 - 2025-01-13 #
Added #
- Basic HTTP client with GET and POST methods
- Request cancellation support via
CancellationToken - Retry policy with decorrelated jitter backoff algorithm
- Interceptors for request/response/error handling
- Built-in
LoggingInterceptorandAuthInterceptor - Cookie store with
MemoryCookieStoreimplementation - Metrics collection with
ConsoleMetricsSink - Cross-platform support (Dart CLI, Flutter, Web)
- IO transport for native platforms
- Web transport for browser platforms
- Redirect policy support
- Type-safe response handling with generics
- Comprehensive error types (
NetworkError,HttpResponseError,TimeoutError,CancellationError)
Security #
- Retries only for idempotent HTTP methods (GET, HEAD, OPTIONS)
- Sensitive headers are masked in logs
- TLS verification enabled by default