From aae892830e005b9930ad85b8dcdd09ad332532aa Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Thu, 15 Aug 2024 11:23:42 +0200 Subject: [PATCH] The json-decorator-scope didn't set the user-agent yet. Add the header-dictionaries from base (which should've got the User-Agent set, at the very least in case we wrap around something that inherits from DefaultUserAgentScope, which is the only use-case I encountered) with the json-specific settings that are already in there. In order to prevent breaking the API, don't directly change the inheritance of the JsonDecoratorScope, but instead check for the existance of the header-dict in the base. CURA-12067 --- UM/TaskManagement/HttpRequestScope.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/UM/TaskManagement/HttpRequestScope.py b/UM/TaskManagement/HttpRequestScope.py index a56e539d0d..be3490df42 100644 --- a/UM/TaskManagement/HttpRequestScope.py +++ b/UM/TaskManagement/HttpRequestScope.py @@ -51,6 +51,10 @@ def __init__(self, base: HttpRequestScope) -> None: "Content-Type": "application/json", "Accept": "application/json" } + # JsonDecorator probably _should_ have inherited from DefaultUserAgentScope in the first place. + # In order to prevent a break in the API by forcing that, just check if there are extra header specs needed. + if hasattr(self.base, "header_dict"): + self.header_dict.update(self.base.header_dict) def requestHook(self, request: QNetworkRequest) -> None: # not calling super().request_hook() because base will do that.