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

Add mime type in ExecuteResponse in runner service #549

Merged
merged 3 commits into from
Apr 9, 2024

Conversation

adambabik
Copy link
Collaborator

Mime type is sent in the first ExecuteReponse that contains any stdout; it is sent only once.

This implementation is pretty native; it analyses the first read stdout chunk and tries to detect the mime type. If it's not found, then the stdout is sent and mime type is not detected again.

The alternative approach might be to buffer stdout and try to detect mime type multiple times until N bytes is read. If there is no result after N bytes, the detection is stopped. Still, the detected mime type should be sent only one per Execute() invocation, however, it could arrive later than in the first ExecuteResponse.

@sourishkrout My approach would be to test this approach against some real world examples. If we are not satisfied with the result, I can implement the alternative.

Closes #545

@adambabik adambabik requested a review from sourishkrout April 7, 2024 21:54
Copy link
Member

@sourishkrout sourishkrout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a number of manual tests with our canonical examples and this works really well already 👍. Let's merge.

Copy link

sonarqubecloud bot commented Apr 9, 2024

@sourishkrout sourishkrout merged commit 48dd275 into main Apr 9, 2024
6 checks passed
@sourishkrout sourishkrout deleted the adamb/mime-type-in-runner-service branch April 9, 2024 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detect media/mime type and return in Runner response
2 participants