mirror of
https://github.com/langgenius/dify.git
synced 2026-03-07 08:35:58 +08:00
refactor(api): enhance request handling and time management
- Initialized `response` variable in `trigger.py` to ensure proper handling in the trigger endpoint. - Updated `http_parser.py` to conditionally set `CONTENT_TYPE` and `CONTENT_LENGTH` headers for improved robustness. - Changed `datetime.utcnow()` to `datetime.now(UTC)` in `sqlalchemy_workflow_trigger_log_repository.py` and `rate_limiter.py` for consistent time zone handling. - Refactored `async_workflow_service.py` to use the public method `get_tenant_owner_timezone` for better encapsulation. - Simplified subscription retrieval logic in `plugin_parameter_service.py` for clarity. These changes improve code reliability and maintainability while ensuring accurate time management and request processing.
This commit is contained in:
@ -86,10 +86,14 @@ def deserialize_request(raw_data: bytes) -> Request:
|
||||
}
|
||||
|
||||
if "Content-Type" in headers:
|
||||
environ["CONTENT_TYPE"] = headers.get("Content-Type")
|
||||
content_type = headers.get("Content-Type")
|
||||
if content_type is not None:
|
||||
environ["CONTENT_TYPE"] = content_type
|
||||
|
||||
if "Content-Length" in headers:
|
||||
environ["CONTENT_LENGTH"] = headers.get("Content-Length")
|
||||
content_length = headers.get("Content-Length")
|
||||
if content_length is not None:
|
||||
environ["CONTENT_LENGTH"] = content_length
|
||||
elif body:
|
||||
environ["CONTENT_LENGTH"] = str(len(body))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user