diff --git a/changelog/12904.bugfix.md b/changelog/12904.bugfix.md new file mode 100644 index 000000000000..da070b945e51 --- /dev/null +++ b/changelog/12904.bugfix.md @@ -0,0 +1 @@ +Refresh headers used in requests (e.g. action server requests) made by `EndpointConfig` using its `headers` attribute. diff --git a/rasa/plugin.py b/rasa/plugin.py index cdbf5f0230d9..b7d5fce5c2aa 100644 --- a/rasa/plugin.py +++ b/rasa/plugin.py @@ -6,15 +6,15 @@ import pluggy from rasa.cli import SubParsersAction -from rasa.engine.storage.storage import ModelMetadata -from rasa.shared.core.trackers import DialogueStateTracker -from rasa.shared.nlu.training_data.message import Message if TYPE_CHECKING: from rasa.core.brokers.broker import EventBroker from rasa.core.tracker_store import TrackerStore from rasa.engine.graph import SchemaNode + from rasa.engine.storage.storage import ModelMetadata from rasa.shared.core.domain import Domain + from rasa.shared.core.trackers import DialogueStateTracker + from rasa.shared.nlu.training_data.message import Message from rasa.utils.endpoints import EndpointConfig @@ -95,8 +95,8 @@ def init_telemetry(endpoints_file: Optional[Text]) -> None: @hookspec # type: ignore[misc] def mock_tracker_for_evaluation( - example: Message, model_metadata: Optional[ModelMetadata] -) -> Optional[DialogueStateTracker]: + example: "Message", model_metadata: Optional["ModelMetadata"] +) -> Optional["DialogueStateTracker"]: """Generate a mocked tracker for NLU evaluation.""" diff --git a/rasa/utils/endpoints.py b/rasa/utils/endpoints.py index 821cdbffa3e9..5e1032778e6b 100644 --- a/rasa/utils/endpoints.py +++ b/rasa/utils/endpoints.py @@ -149,6 +149,9 @@ async def request( headers.update(kwargs["headers"]) del kwargs["headers"] + if self.headers: + headers.update(self.headers) + url = concat_url(self.url, subpath) sslcontext = None