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

Support binary payloads and responses, and non-UTF8 string payloads for Python functions #205

Open
jpauwels opened this issue May 29, 2020 · 0 comments

Comments

@jpauwels
Copy link

The Python templates currently don't support binary payloads and responses, whereas other templates do (e.g. image-handling functions in store). Much like #203 and #159 for Java, it would be nice to add this capability to the Python templates. Additionally, string payloads are assumed to be UTF-8 encoded, even if content-type signals differently.

Expected Behaviour

When passing binary payload, don't decode to string. When passing string payload, respect content-type encoding.
When returning binary file, don't encode as string.

Current Behaviour

UnicodeDecodeError when passing binary payload, incorrect decoding when passing non-UTF-8 string payload. Binary responses get stringified.

Possible Solution

I've got this fixed and working for more than a year in my custom template, happy to send a PR

Steps to Reproduce (for bugs)

Context

Using audio files as payload

Your Environment

  • Docker version docker version (e.g. Docker 17.0.05 ):
    All
  • Are you using Docker Swarm or Kubernetes (FaaS-netes)?
    Swarm
  • Operating System and version (e.g. Linux, Windows, MacOS):
    Linux, MacOS
  • Link to your project or a code example to reproduce issue:
@jpauwels jpauwels changed the title Support binary payloads and responses, and non-UTF8 string payloads Support binary payloads and responses, and non-UTF8 string payloads for Python functions May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant