mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix: pass application/json for GenericAPILogger (#10772)
* fix: pass application/json for GenericAPILogger * fix: test_generic_api_callback
This commit is contained in:
parent
51930c07c5
commit
a4fb1da2d9
2 changed files with 6 additions and 1 deletions
|
|
@ -74,7 +74,9 @@ class GenericAPILogger(CustomBatchLogger):
|
|||
headers: Optional[dict] = None
|
||||
"""
|
||||
# Process headers from different sources
|
||||
headers_dict = {}
|
||||
headers_dict = {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
# 1. First check for headers from env var
|
||||
env_headers = os.getenv("GENERIC_LOGGER_HEADERS")
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ async def test_generic_api_callback():
|
|||
print("##########\n")
|
||||
print("logs were flushed to URL", actual_url, "with the following headers", mock_post.call_args[1]["headers"])
|
||||
assert actual_url == test_endpoint, f"Expected URL {test_endpoint}, got {actual_url}"
|
||||
|
||||
# Validate headers
|
||||
assert mock_post.call_args[1]["headers"]["Content-Type"] == "application/json", "Content-Type should be application/json"
|
||||
|
||||
# For the GenericAPILogger, it sends the payload directly as JSON in the data field
|
||||
json_data = mock_post.call_args[1]["data"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue