Skip to content

Commit 7d5c3ad

Browse files
authored
fix: ws scheme (#211)
1 parent 3380b3b commit 7d5c3ad

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

docarray/array/mixins/post.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,17 @@ def post(
4545
)
4646
batch_size = batch_size or len(self)
4747

48-
if r.scheme.startswith('jinahub'):
48+
_scheme = r.scheme
49+
_tls = False
50+
51+
if _scheme in ('grpcs', 'https', 'wss'):
52+
_scheme = _scheme[:-2]
53+
_tls = True
54+
55+
if _scheme == 'ws':
56+
_scheme = 'websocket' # temp fix for the core
57+
58+
if _scheme.startswith('jinahub'):
4959
from jina import Flow
5060

5161
f = Flow(quiet=True, prefetch=1).add(uses=standardized_host)
@@ -57,13 +67,13 @@ def post(
5767
request_size=batch_size,
5868
parameters=parameters,
5969
)
60-
elif r.scheme in ('grpc', 'http', 'ws'):
70+
elif _scheme in ('grpc', 'http', 'ws', 'websocket'):
6171
if _port is None:
6272
raise ValueError(f'can not determine port from {host}')
6373

6474
from jina import Client
6575

66-
c = Client(host=r.hostname, port=_port, protocol=r.scheme)
76+
c = Client(host=r.hostname, port=_port, protocol=_scheme, https=_tls)
6777
return c.post(
6878
_on,
6979
inputs=self,

0 commit comments

Comments
 (0)