flutter_fixtures_dio 0.3.1 copy "flutter_fixtures_dio: ^0.3.1" to clipboard
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), or LiveOrigin — so apps and logging read one value instead of combining header strings. FixturesInterceptor now stamps every served response with x-fixture-document (FixturesInterceptor.documentHeader) alongside the existing x-fixture-file-path (filePathHeader).

  • BREAKING: FixturesInterceptor takes one pipeline (FixturePipeline<HttpFixtureRequest>) instead of sources / mockFolder / assetLoader / dataSelector / dataSelectorView / dataSelectorDelay; build the pipeline once next to the Dio instance so remembered choices survive. A miss rejects with a DioException whose error is the typed FixtureMiss (message carries the text).

0.3.0 #

  • New RecorderInterceptor: captures real HTTP traffic and replays it through core's TrafficRecorder seam (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 an x-fixture-replayed header (RecorderInterceptor.replayedHeader), and an error status per the request's validateStatus surfaces as DioException.badResponse. Request payloads that are not JSON data (multipart FormData) are recorded as strings so they never block a save.

  • FixturesInterceptor resolves 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.

  • FixturesInterceptor builds requests with HttpFixtureRequest.fromUri over options.uri: absolute request URLs and query parameters embedded in the URL string now resolve fixtures correctly.

  • The sources field is now an HttpFixtureSources composite (the constructor still takes a plain list); the source-precedence loop moved to core.

  • BREAKING: FixturesInterceptor now owns the HTTP fixture pipeline: it maps each request to an HttpFixtureRequest and consults an ordered HttpFixtureSource list (sources); the first source that resolves wins and provides the selected document's payload. Pass sources: (or mockFolder:/assetLoader: for the default file source) instead of dataQuery:. Defaults to fixture files (HttpFileFixtureSource); add OpenApiFixtureSource to derive fixtures from an OpenAPI 3.x spec for requests no earlier source covers.

  • BREAKING: DioDataQuery was removed — HttpFixtureSource is the extension point for custom HTTP fixture providers. The file naming convention lives in HttpFileFixtureSource in core.

  • The interceptor drives core's FixtureSelector.serve pipeline and maps each FixtureOutcome to 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.
  • DioDataQuery accepts an assetLoader, making find testable without a Flutter asset bundle; fixture IO is delegated to core's FixtureSource.
  • 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 dataSelectorDelay parameter to FixturesInterceptor to 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 Fixture mixin to FixtureSelector for 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
1
likes
120
points
143
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Dio implementation for Flutter Fixtures

Repository (GitHub)
View/report issues
Contributing

Topics

#mock #http #testing #fixtures

License

MIT (license)

Dependencies

dio, flutter, flutter_fixtures_core

More

Packages that depend on flutter_fixtures_dio