Umang01-hash
released this
24 Dec 13:12
·
3 commits
to development
since this release
Release v1.29.0
✨ Features:
- Custom Metadata in Responses
Users can now include metadata in API responses using theresponse.Response
struct. This allows for clean, structured responses while providing additional contextual information.- Response Structure:
- With Metadata:
{ "data": {}, "metadata": {} }
- Without Metadata:
{ "data": {} }
- With Metadata:
- Example Usage:
func HelloHandler(c *gofr.Context) (interface{}, error) { headers := map[string]string{ "X-Custom-Header": "CustomValue", } metaData := map[string]any{ "environment": "staging", "timestamp": time.Now(), } return response.Response{ Data: map[string]string{"message": "Hello, World!"}, Metadata: metaData, Headers: headers, }, nil }
- Response Structure:
- Support for Redis Database Selection:
- Introduces a new config
REDIS_DB
to specify the Redis database index to be used. - Example usage:
os.Setenv("REDIS_DB", "1")
🛠️ Fixes:
- Disconnected Spans Exported for Remote-log-url:
- Resolves an issue where disconnected spans were created for each fetch request of the remote log.
- Ensures that all traces exported for a single HTTP request have spans in hierarchy.
- Hardcoded Ports Fix:
- Addresses the issue of hardcoded ports within the codebase.
- Now allows for dynamic port configuration, improving flexibility and deployment scenarios.
- Lowercase Default Paths for CRUD Helpers:
- Changes the default paths for CRUD helpers to be in lowercase.
- Helps avoid confusion caused by case sensitivity on certain servers.