mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 19:03:30 -05:00
Both trace_id and span_id headers must be present
This commit is contained in:
@@ -38,6 +38,7 @@ class NotifyAdminAPIClient(BaseAPIClient):
|
||||
if not has_request_context():
|
||||
return headers
|
||||
headers['X-B3-TraceId'] = request.request_id
|
||||
headers['X-B3-SpanId'] = request.span_id
|
||||
return headers
|
||||
|
||||
def check_inactive_service(self):
|
||||
|
||||
@@ -99,6 +99,7 @@ def test_generate_headers_sets_request_id_if_in_request_context(app_):
|
||||
headers = api_client.generate_headers('api_token')
|
||||
|
||||
assert set(headers.keys()) == {
|
||||
'Authorization', 'Content-type', 'User-agent', 'X-Custom-Forwarder', 'X-B3-TraceId'
|
||||
'Authorization', 'Content-type', 'User-agent', 'X-Custom-Forwarder', 'X-B3-TraceId', 'X-B3-SpanId',
|
||||
}
|
||||
assert headers['X-B3-TraceId'] == request_context.request.request_id
|
||||
assert headers['X-B3-SpanId'] == request_context.request.span_id
|
||||
|
||||
Reference in New Issue
Block a user