diff --git a/src/connector_http/http_request_base.py b/src/connector_http/http_request_base.py index ed86048..83b1682 100644 --- a/src/connector_http/http_request_base.py +++ b/src/connector_http/http_request_base.py @@ -1,6 +1,7 @@ import json import time from collections.abc import Callable +from typing import Any import requests # type: ignore import xmltodict @@ -71,7 +72,7 @@ def log(msg: str) -> None: try: log(f"Will call {self.url}") - arguments = { + arguments: dict[str, Any] = { "url": self.url, "headers": self.headers, "auth": auth, @@ -80,6 +81,8 @@ def log(msg: str) -> None: if self.params is not None: arguments["params"] = self.params if self.data is not None: + if not arguments["headers"].keys().include("Content-Type", "Content-type"): + arguments["headers"]["Content-Type"] = "application/json" arguments["json"] = self.data http_response = request_function(**arguments) log(f"Did call {self.url}")