http_hook 0.0.4
http_hook: ^0.0.4 copied to clipboard
Lightweight Dart HTTP request interception and mocking library. Supports URL matching, templates, regex, wildcards, and pass-through.
Changelog #
0.0.4 #
Features #
- Flexible Response Body Types: Support for String, List
- Binary Response Support: Added
HttpHookResponse.binary()
factory for binary data - Streaming Response Support: Added
HttpHookResponse.stream()
factory for streaming data - Common HTTP Status Responses: Added convenient factories for common HTTP status codes
HttpHookResponse.notFound()
- 404 Not FoundHttpHookResponse.internalServerError()
- 500 Internal Server ErrorHttpHookResponse.badRequest()
- 400 Bad RequestHttpHookResponse.unauthorized()
- 401 UnauthorizedHttpHookResponse.forbidden()
- 403 Forbidden
Improvements #
- Enhanced Response Flexibility: HttpHookResponse.body now accepts String, List
- Better Binary Data Handling: Native support for binary responses without string conversion
- Streaming Capabilities: Direct support for streaming responses for large data scenarios
- Simplified Async Handling: Async operations are handled in the response handler, not in the response body
- Removed Redundant API: Removed
HttpHookResponse.error()
as it was functionally equivalent to the constructor
Documentation #
- Added Examples: New examples for binary, streaming, and async responses
0.0.2 #
Features #
- Pass-through functionality: Added
HttpHookResponse.passThrough()
for conditional real HTTP requests - Wildcard host matching:
onTemplate
andonRegex
withoutdefaultUrl
parameter match any host
Breaking Changes #
defaultUrl
parameter inonTemplate
/onRegex
is now optional with default empty string for wildcard support
0.0.1 #
- initial release.