MartinSahlen/cloud-functions-python

Please explain handle_http_event(handle_fn):

Closed this issue · 0 comments

I'm test to check the output of the function before deploying the function on the cloud function.

Can anyone explain what's happening here

I am able to send my data inside the body of the return Response here

My program is getting stuck

def handle_http_event(handle_fn):
    req = Request(json.loads(sys.stdin.read()))
    res = handle_fn(req)
    if isinstance(res, Response):
        sys.stdout.write(res._json_string())
    else:
        sys.stdout.write(Response()._json_string()) 

Getting stuck at req = Request(json.loads(sys.stdin.read())) not proceeding further

I'm confused, can anyone help?

PS: I have copy pasted this in my function.py