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

Fixed bug with missing content-type #893

Merged
merged 2 commits into from
Jun 28, 2023
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
15 changes: 8 additions & 7 deletions packages/python-runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ async def run_instance(self, config, args):

self.logger.info(f'Sending PANG')
monitoring = self.streams[CC.MONITORING]

produces = getattr(result, 'provides', None) or getattr(self.sequence, 'provides', None)
if produces:
self.logger.info(f'Sending PANG with {produces}')
Expand Down Expand Up @@ -250,17 +249,19 @@ async def connect_input_stream(self, input_stream):


async def forward_output_stream(self, output):
if hasattr(output, 'content_type'):
content_type = output.content_type

if hasattr(output, 'provides'):
attribute = getattr(self.sequence, 'provides', None)
content_type = attribute['contentType']
else:
# Deprecated
if hasattr(self.sequence, 'output_type'):
content_type = self.sequence.output_type
if hasattr(self.sequence, 'provides'):
attribute = getattr(self.sequence, 'provides', None)
content_type = attribute['contentType']
else:
self.logger.debug('Output type not set, using default')
content_type = 'text/plain'

self.logger.info(f'Content-type: {content_type}')

if content_type == 'text/plain':
self.logger.debug('Output stream will be treated as text and encoded')
output = output.map(lambda s: s.encode())
Expand Down
Loading