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

Make sure aiohttp web response body is a binary #199

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

oavdeev
Copy link
Collaborator

@oavdeev oavdeev commented Jul 7, 2021

If you look at aiohttp docs, body is supposed to be a binary, not string. It mostly works if you pass a string, however some auxiliary things break -- I've ran into some issues because of this while trying to use aiohttp-devel.

elif isinstance(exception, IndexError):
return DBResponse(response_code=404, body={})
else:
return DBResponse(response_code=500, body=json.dumps(body))
Copy link
Collaborator Author

@oavdeev oavdeev Jul 7, 2021

Choose a reason for hiding this comment

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

Unless I'm missing something, before this fix body was doubly-encoded here and at https://github.com/Netflix/metaflow-service/blob/master/services/metadata_service/api/utils.py#L24

Copy link
Contributor

Choose a reason for hiding this comment

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

This is somewhat duplicative of #184 (or the idea is for that to be the cleanup PR). I need to change things in the client too and we need to support both ways of doing things. But yes, this is planned.

@oavdeev oavdeev marked this pull request as draft December 4, 2021 04:38
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.

None yet

2 participants