From 83abdf76025aaf7f1544864e1a0b29ad194a7711 Mon Sep 17 00:00:00 2001 From: Jonathan Edey Date: Tue, 13 Feb 2024 13:24:07 -0500 Subject: [PATCH] fix removed typo --- firebase_admin/functions.py | 11 ++++++++++- tests/test_functions.py | 1 - 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/firebase_admin/functions.py b/firebase_admin/functions.py index 536c8d1c2..42c63118a 100644 --- a/firebase_admin/functions.py +++ b/firebase_admin/functions.py @@ -272,6 +272,11 @@ def _validate_task_options( ', or underscores (_). The maximum length is 500 characters.') task.name = self._get_url( resource, _CLOUD_TASKS_API_RESOURCE_PATH + f'/{opts.task_id}') + if opts.uri is not None: + if not _Validators.is_url(opts.uri): + raise ValueError( + 'uri must be a valid RFC3986 URI string using the https or http schema.') + task.http_request['url'] = opts.uri return task def _update_task_payload(self, task: Task, resource: Resource, extension_id: str) -> Task: @@ -382,12 +387,17 @@ class TaskOptions: By default, Content-Type is set to 'application/json'. The size of the headers must be less than 80KB. + + uri: The full URL path that the request will be sent to. Must be a valid RFC3986 https or + http URL. + """ schedule_delay_seconds: Optional[int] = None schedule_time: Optional[datetime] = None dispatch_deadline_seconds: Optional[int] = None task_id: Optional[str] = None headers: Optional[Dict[str, str]] = None + uri: Optional[str] = None @dataclass class Task: @@ -407,7 +417,6 @@ class Task: schedule_time: Optional[str] = None dispatch_deadline: Optional[str] = None -Task() @dataclass class Resource: """Contains the parsed address of a resource. diff --git a/tests/test_functions.py b/tests/test_functions.py index 90206129d..a9ef76fc0 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -303,4 +303,3 @@ def test_invalid_task_id_error(self, task_id): 'task_id can contain only letters ([A-Za-z]), numbers ([0-9]), ' 'hyphens (-), or underscores (_). The maximum length is 500 characters.' ) -