diff --git a/openeo_driver/views.py b/openeo_driver/views.py index b5a899b4..e6233a2a 100644 --- a/openeo_driver/views.py +++ b/openeo_driver/views.py @@ -669,6 +669,10 @@ def result(user: User): backend_implementation.request_costs(success=False, user=user, request_id=request_id) raise + # Add request id as "OpenEO-Identifier" like we do for batch jobs. + # TODO: follow-up standardization at https://github.com/Open-EO/openeo-api/pull/533 + response.headers["OpenEO-Identifier"] = request_id + return response @blueprint.route('/execute', methods=['POST']) diff --git a/tests/test_views_execute.py b/tests/test_views_execute.py index 6d82e4a9..1feaf92c 100644 --- a/tests/test_views_execute.py +++ b/tests/test_views_execute.py @@ -1,4 +1,5 @@ import dataclasses +import dirty_equals import json import math import re @@ -4223,3 +4224,10 @@ def test_to_scl_dilation_mask_defaults(api, arguments, expected): args, kwargs = dummy.to_scl_dilation_mask.call_args assert args == () assert kwargs == expected + + +def test_synchronous_processing_response_header_openeo_identifier(api): + with mock.patch.object(FlaskRequestCorrelationIdLogging, "_build_request_id", return_value="r-abc123"): + res = api.result({"add1": {"process_id": "add", "arguments": {"x": 3, "y": 5}, "result": True}}) + assert res.assert_status_code(200).json == 8 + assert res.headers["OpenEO-Identifier"] == "r-abc123"