joker 0.2.1+1 copy "joker: ^0.2.1+1" to clipboard
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:io imports 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 HttpOverrides remains native-only (mobile, desktop, server)
    • For Web platform, use companion packages joker_http or joker_dio for HTTP interception
  • Refactored file operations to use conditional imports:
    • JokerResponse.jsonFile() moved to JokerResponseFile.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.yaml including web
  • 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_interop instead of deprecated dart.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_http or joker_dio for HTTP interception
  • WASM: Fully compatible and ready for WASM compilation (no non-WASM compliant libraries)

Breaking Changes #

  • JokerResponse.jsonFile() is now JokerResponseFile.jsonFile() (only on native platforms)
  • File-based operations will throw UnsupportedError on 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 dio and http packages by fixing several noSuchMethod errors 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
  • 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.
4
likes
160
points
103
downloads

Documentation

API reference

Publisher

verified publisherduckytie.com

Weekly Downloads

HTTP request stubbing and mocking library for Dart. Intercept HTTP requests from any library using HttpOverrides.

Homepage
Repository (GitHub)
View/report issues
Contributing

License

MIT (license)

More

Packages that depend on joker