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

Httpheaders #1638

Merged
merged 4 commits into from
Apr 13, 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
11 changes: 9 additions & 2 deletions autobahn/wamp/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def _create_transport(index, transport, check_native_endpoint=None):
valid_transport_keys = [
'type', 'url', 'endpoint', 'serializer', 'serializers', 'options',
'max_retries', 'max_retry_delay', 'initial_retry_delay',
'retry_delay_growth', 'retry_delay_jitter', 'proxy',
'retry_delay_growth', 'retry_delay_jitter', 'proxy', 'headers'
]
for k in transport.keys():
if k not in valid_transport_keys:
Expand Down Expand Up @@ -161,6 +161,8 @@ def _create_transport(index, transport, check_native_endpoint=None):
'options must be a dict, not {}'.format(type(options))
)

headers = transport.get("headers")

if kind == 'websocket':
for key in ['url']:
if key not in transport:
Expand Down Expand Up @@ -227,6 +229,8 @@ def _create_transport(index, transport, check_native_endpoint=None):
endpoint_config = transport['endpoint']
if 'serializers' in transport:
raise ValueError("'serializers' is only for websocket; use 'serializer'")
if headers is not None:
raise ValueError("'headers' not supported for rawsocket transport")
# always a list; len == 1 for rawsocket
if 'serializer' in transport:
if not isinstance(transport['serializer'], (str, str)):
Expand All @@ -252,6 +256,7 @@ def _create_transport(index, transport, check_native_endpoint=None):
serializers=serializer_config,
proxy=proxy,
options=options,
headers=headers,
**kw
)

Expand All @@ -268,7 +273,8 @@ def __init__(self, idx, kind, url, endpoint, serializers,
retry_delay_growth=1.5,
retry_delay_jitter=0.1,
proxy=None,
options=None):
options=None,
headers=None):
"""
"""
if options is None:
Expand All @@ -279,6 +285,7 @@ def __init__(self, idx, kind, url, endpoint, serializers,
self.url = url
self.endpoint = endpoint
self.options = options
self.headers = headers

self.serializers = serializers
if self.type == 'rawsocket' and len(serializers) != 1:
Expand Down
Loading