joker 0.2.1+1
joker: ^0.2.1+1 copied to clipboard
HTTP request stubbing and mocking library for Dart. Intercept HTTP requests from any library using HttpOverrides.
Changelog #
0.2.1+1 #
🌐 Web and WASM Compatibility Improvements #
- Fixed Web and WASM compatibility by removing
dart:ioimports from shared code- Package can now be imported on Web without errors
- Core stubbing methods (
stubJson(),stubJsonArray(),stubText()) work on all platforms - Automatic HTTP interception via
HttpOverridesremains native-only (mobile, desktop, server) - For Web platform, use companion packages
joker_httporjoker_diofor HTTP interception
- Refactored file operations to use conditional imports:
JokerResponse.jsonFile()moved toJokerResponseFile.jsonFile()extension (native only)Joker.stubJsonFile()now uses platform-specific implementations- File operations only available on native platforms (mobile, desktop, server)
- Clear error messages on web when trying to use file operations
- Added explicit platform declarations in
pubspec.yamlincludingweb - Made
stubUrl()method public for advanced use cases - Updated documentation to indicate platform-specific limitations
- Migrated to WASM-ready conditional imports using
dart.library.js_interopinstead of deprecateddart.library.html- Package is now fully WASM-compatible
- No imports of non-WASM compliant libraries (
dart:html,dart:js, etc.) - Ready for future WASM compilation targets
Platform Support #
- ✅ Native platforms (Android, iOS, Linux, macOS, Windows): Full support with automatic HTTP interception
- ✅ Web platform: Package imports successfully, core stubbing works, requires
joker_httporjoker_diofor HTTP interception - ✅ WASM: Fully compatible and ready for WASM compilation (no non-WASM compliant libraries)
Breaking Changes #
JokerResponse.jsonFile()is nowJokerResponseFile.jsonFile()(only on native platforms)- File-based operations will throw
UnsupportedErroron web platforms
0.2.0 #
- Conditional imports for platform-specific implementations.
- Improved support for web applications.
- Updated dependencies for better compatibility.
0.1.1+1 #
- Improved compatibility with
dioandhttppackages by fixing severalnoSuchMethoderrors in HTTP client implementations - Enhanced HTTP client response handling to provide better compatibility with different HTTP client libraries
- Updated README with comprehensive API documentation including all available methods:
- Added documentation for
stubJsonArray()method for JSON array responses - Added documentation for
stubText()method for plain text responses - Added documentation for
stubJsonFile()method for loading JSON from files - Added complete parameter tables for all stubbing methods
- Added detailed examples for stub management and dynamic configuration
- Improved organization with clear method categorization
- Added documentation for
- Better error handling and more robust HTTP request/response mocking
- Fixed internal method implementations to prevent runtime errors when used with popular HTTP client packages
0.1.0 #
- Initial release of the Joker library for HTTP request stubbing and mocking in Dart.
- Intercept HTTP requests from any library using HttpOverrides.
- Provides a simple and flexible API for defining request handlers and responses.
- Supports various HTTP methods, headers, and body content types.
- Includes utilities for verifying requests and managing mock server state.