sleek_http_client 1.3.0
sleek_http_client: ^1.3.0 copied to clipboard
A sleek, pure-Dart HTTP client with connectivity checking, token refresh, multipart support, and structured logging.
Changelog #
1.3.0 #
- Added per-request
extra:send/sendMultipartRequestacceptextra: {...}, readable in interceptors viarequest.extra[key](newRequestExtraextension onhttp.BaseRequest). It is never sent as an HTTP header, and is copied bycopyAsNew()so it survives a retry. - BREAKING (log format)
LoggingInterceptornow logs one message per call (status icon, duration, bodies on their own lines, host in a[label]) instead of one line for the request and one for the response. The[SleekHttp]prefix is gone and bodies are cut after 500 characters. See the README for the new format. - Added
LoggingInterceptoroptionslayout,labelBuilder,leading,logRequestsandmaxBodyLength. example/main.dart: new scenario showing theLoggingInterceptoroutput.authorityGetteris now optional: the authority can be passed per call instead. AStateErroris thrown when a request is built with neither.sendMultipartRequestnow accepts a per-callauthority, likesend.
1.2.0 #
LoggingInterceptornow also logs exceptions thrown down the chain instead of a response (no internet, timeout, DNS / connection failure, ...) on a❌line, then rethrows them unchanged.- Fixed
send<void>()/send<Null>()/send<Object?>()throwingUnimplementedError(after the request was processed by the server) instead of resolving tonull. - Fixed the timeout not covering the request sending phase (only the body reading): a server that never sent its headers could block a request until the OS-level TCP timeout.
- Fixed a deadlock in
TokenRefreshInterceptorwhen the refresh callback sends its request through the same client after anawait(or behind an asynchronous interceptor): requests toexcludedPathsno longer wait for the in-flight refresh. - An empty success body is now treated like a JSON
nullforJsonObject/JsonList:send<JsonObject?>()resolves tonull,send<JsonObject>()throwsNullResponseBodyException(previously both threw aFormatException).
1.1.0 #
- Added
JsonHttpResponseextension onhttp.Response(isJson,decodeJson<T>(),tryDecodeJson<T>()) so JSON response helpers can be used on anyhttp.Response, not just those produced bySleekHttpClient.
1.0.0 #
- BREAKING Replaced
HttpRetryPolicy/HttpRetryPolicyBuilder/TokenRefreshHandlerandHttpClientLogConfig(logConfig) with a single composableHttpInterceptorchain (SleekHttpClient.interceptors), includingTokenRefreshInterceptorandLoggingInterceptor. - BREAKING
send<T>/sendMultipartRequest<T>now returnTinstead ofT?.T's own nullability drives behavior forJsonObject/JsonList:send<JsonObject>()requires a non-null body and throws the newNullResponseBodyExceptionif the server returns JSONnull, whilesend<JsonObject?>()returnsnullin that case. A malformed body or unexpected JSON shape always throws (FormatException/TypeError), regardless of nullability — it is no longer silently swallowed tonull.
0.1.0 #
- Initial release