Closed pyramation closed 3 years ago
Can I ask why you need the content length and how you are using it? You're seeing -1 due to a chunked HTTP request, where the data is streamed so no length is available
/set title: Support request about content length
I'm using a built-in python3 library, http.server
. All of my research leads to similar methods that read content-length
header to parse the body of the request.
After reading your reply, I started to research into chunked encoding, but I'm not sure if http.server
can do it. Did you mention there is a way to tell the of-watchdog system to use content-length
?
Thanks again! I think I'm just gonna use the flask template for now, seems light weight enough! Thanks for the info, I'm happy to understand the inter-workings and now accept that I should just use a system that abstracts the chucked/content-length
Expected Behaviour
when
POST
ing a request to a cloud funtion, the request body should be available inside the cloud function. Specifically, the header forcontent-length
should be set and the data should be readable.We should expect, for example,
to respond with:
Current Behaviour
Currently the response is missing the body completely. When I check content length it is not > 0, hence the result:
area of interest: https://github.com/pyramation/python-template-openfaas-of-watchdog-issue/blob/master/template/python3/index.py#L31-L34
Steps to Reproduce (for bugs)
Since the functions are just passing through params, we can build and deploy them immediately:
For python 2.7
For python 3
Context
Trying to create languages for of-watchdog, so I can manipulate headers and create a connector that I'm working on in postgres. Currently nodejs works, so I'm a bit baffled by this body parsing issue.
Your Environment