Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CURA-12067] Unless scope is overridden, always send a user-agent with HTTP(S) get/put. #963

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions UM/TaskManagement/HttpRequestManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
from PyQt6.QtCore import QObject, QUrl, Qt, pyqtSignal, pyqtProperty
from PyQt6.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply

from UM.Application import Application
from UM.Logger import Logger
from UM.TaskManagement.HttpRequestData import HttpRequestData
from UM.TaskManagement.HttpRequestScope import HttpRequestScope
from UM.TaskManagement.HttpRequestScope import DefaultUserAgentScope, HttpRequestScope
from UM.TaskManagement.TaskManager import TaskManager


Expand Down Expand Up @@ -286,8 +287,9 @@ def _createRequest(self, http_method: str, url: str,
for key, value in headers_dict.items():
request.setRawHeader(key.encode("utf-8"), value.encode("utf-8"))

if scope is not None:
scope.requestHook(request)
if scope is None:
scope = DefaultUserAgentScope(Application.getInstance())
scope.requestHook(request)

# Generate a unique request ID
request_id = uuid.uuid4().hex
Expand Down
Loading