Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comprehensive form and JSON parameter parsing middleware #109

Merged
merged 6 commits into from
Feb 15, 2025

Conversation

wesen
Copy link
Collaborator

@wesen wesen commented Feb 11, 2025

Adds robust middleware for handling form data and JSON request parameters in Parka:

Core Changes:

  • Implements structured FormMiddleware for handling multipart form data and file uploads
  • Adds JSONBodyMiddleware for processing JSON POST request bodies
  • Both middlewares support proper temporary file cleanup
  • Thread-safe file management with mutex protection
  • Comprehensive parameter type handling including arrays and objects

Features:

  • Safe temporary file handling with automatic cleanup
  • Support for file-like parameters in both form and JSON requests
  • Array parameter handling with proper type conversion
  • Required parameter validation
  • Structured error handling and reporting

Improvements:

  • Refactored form handling into a proper middleware struct
  • Added comprehensive test coverage
  • Added detailed documentation and usage examples
  • Improved error messages and validation

Breaking Changes:

  • UpdateFromFormQuery now uses structured middleware internally
  • Middleware execution order may need to be adjusted in existing code

@wesen wesen merged commit f1de228 into go-go-golems:main Feb 15, 2025
2 checks passed
@wesen wesen deleted the task/add-json-post-body-middleware branch February 15, 2025 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant