flutter_fixtures_dio 0.3.1
flutter_fixtures_dio: ^0.3.1 copied to clipboard
Dio implementation for Flutter Fixtures
Changelog #
0.3.1 #
-
ResponseOrigin.of(response)names where a response came from —FixtureOrigin(document identifier + external file path),ReplayOrigin(capture time), orLiveOrigin— so apps and logging read one value instead of combining header strings.FixturesInterceptornow stamps every served response withx-fixture-document(FixturesInterceptor.documentHeader) alongside the existingx-fixture-file-path(filePathHeader). -
BREAKING:
FixturesInterceptortakes onepipeline(FixturePipeline<HttpFixtureRequest>) instead ofsources/mockFolder/assetLoader/dataSelector/dataSelectorView/dataSelectorDelay; build the pipeline once next to the Dio instance so remembered choices survive. A miss rejects with aDioExceptionwhoseerroris the typedFixtureMiss(messagecarries the text).
0.3.0 #
-
New
RecorderInterceptor: captures real HTTP traffic and replays it through core'sTrafficRecorderseam (engine:flutter_fixtures_recorder). Replay wins over later response-producing interceptors; misses forward to the network or reject (ReplayMissBehavior). Request identity comes from core (HttpFixtureRequest.canonicalTarget) — no HTTP normalization lives in this package — and capture is lazy, so idle traffic costs nothing. Replayed responses behave like the live ones did: they resolve through the response-interceptor chain, carry anx-fixture-replayedheader (RecorderInterceptor.replayedHeader), and an error status per the request'svalidateStatussurfaces asDioException.badResponse. Request payloads that are not JSON data (multipartFormData) are recorded as strings so they never block a save. -
FixturesInterceptorresolves through the response-interceptor chain (callFollowingResponseInterceptor: true), so interceptors registered before it — logging,RecorderInterceptor— observe fixture-served responses. Composed with the recorder, fixture responses chosen by hand can be recorded into a session and replayed without dialogs. -
FixturesInterceptorbuilds requests withHttpFixtureRequest.fromUrioveroptions.uri: absolute request URLs and query parameters embedded in the URL string now resolve fixtures correctly. -
The
sourcesfield is now anHttpFixtureSourcescomposite (the constructor still takes a plain list); the source-precedence loop moved to core. -
BREAKING:
FixturesInterceptornow owns the HTTP fixture pipeline: it maps each request to anHttpFixtureRequestand consults an orderedHttpFixtureSourcelist (sources); the first source that resolves wins and provides the selected document's payload. Passsources:(ormockFolder:/assetLoader:for the default file source) instead ofdataQuery:. Defaults to fixture files (HttpFileFixtureSource); addOpenApiFixtureSourceto derive fixtures from an OpenAPI 3.x spec for requests no earlier source covers. -
BREAKING:
DioDataQuerywas removed —HttpFixtureSourceis the extension point for custom HTTP fixture providers. The file naming convention lives inHttpFileFixtureSourcein core. -
The interceptor drives core's
FixtureSelector.servepipeline and maps eachFixtureOutcometo its Dio response or rejection, keeping the existing error messages.
0.2.0 #
- BREAKING: a selected fixture whose description does not start with a 3-digit status code now rejects with a clear error instead of throwing
FormatException. DioDataQueryaccepts anassetLoader, makingfindtestable without a Flutter asset bundle; fixture IO is delegated to core'sFixtureSource.- A matched fixture file with malformed JSON now reports the parse error instead of "no fixture found".
- Query-parameter candidate priority (exact → values →
*→{{key}}) is now documented.
0.1.3 #
- Support JSON arrays as response data in
DataQuery.
0.1.2 Response Delay #
- Add
dataSelectorDelayparameter toFixturesInterceptorto simulate response delays.
0.1.1 Mustache matching refinements #
- Remove hardcoded mustache placeholder generation; placeholders now only match actual request query parameter keys (alphabetically sorted) when building candidates.
- Keep candidate order: exact > value-appended > star-by-count > mustache-by-keys.
- Update tests accordingly and minor internal cleanups.
0.1.0 First Minor Release #
- Updated all packages to version 0.1.0
- Renamed
Fixturemixin toFixtureSelectorfor better clarity - Improved documentation across all packages
- Added comprehensive CONTRIBUTING.md guide
- Added MIT License
- Updated GitHub repository references to brotoo25/flutter_fixtures
0.0.1 Initial Release #
- Initial release of Flutter Fixtures
- Restructured as a workspace with multiple packages:
- flutter_fixtures_core: Core interfaces and domain models
- flutter_fixtures_dio: Dio implementation
- flutter_fixtures_ui: UI components
- flutter_fixtures: Meta-package that depends on all the above
- Support for Dio HTTP client
- Three fixture selection modes: Random, Default, and Pick
- Dialog-based UI for user selection
- Example app demonstrating basic and advanced usage