Files
Fabric/plugins/template/fetch.md
Matt Joyce b6eb969b3a feat(template): implement core plugin system and utility plugins
Add initial set of utility plugins for the template system:
- datetime: Date/time formatting and manipulation
- fetch: HTTP content retrieval and processing
- file: File system operations and content handling
- sys: System information and environment access
- text: String manipulation and formatting operations

Each plugin includes:
- Implementation with comprehensive test coverage
- Markdown documentation of capabilities
- Integration with template package

This builds on the template system to provide practical utility functions
while maintaining a focused scope for the initial plugin release.
2024-11-21 14:27:22 +11:00

828 B

Fetch Plugin Tests

Simple test file for validating fetch plugin functionality.

Basic Fetch Operations

Raw Content:
{{plugin:fetch:get:https://raw.githubusercontent.com/user/repo/main/README.md}}

JSON API:
{{plugin:fetch:get:https://api.example.com/data.json}}

Error Cases

These should produce appropriate error messages:

Invalid Operation:
{{plugin:fetch:invalid:https://example.com}}

Invalid URL:
{{plugin:fetch:get:not-a-url}}

Non-text Content:
{{plugin:fetch:get:https://example.com/image.jpg}}

Server Error:
{{plugin:fetch:get:https://httpstat.us/500}}

Security Considerations

  • Only use trusted URLs
  • Be aware of rate limits
  • Content is limited to 1MB
  • Only text content types are allowed
  • Consider URL allow listing in production
  • Validate and sanitize fetched content before use