I have a google app script deployed as a web app with doPost() handler . The handler function exposes a sort of remote procedure call functionality , and allows my embedded iot devices to POST parameters as a client , and receives status values , both in JSON format . I use bare metal C resources to do so , i.e. I implement basic HTTP POST request protocol on top of the TCP socket.
The POST request is straight forward , the doPost() handler is called , and it updates my Google Sheet with the send JSON parameters. The status of the app function ("OK" / "FAILED") is then returned to the client . Here is where things went south for me. The client , instead of receiving the POST response , receives a HTTP 302 redirect URL https://script.googleusercontent.com/xxxx with URL parameters . I now need to start an HTTP GET session with the new url, and then I receive the desired original POST response.
So it actaully works , and quite reliably so . But , what is the reason for that complicated redirection with a subsequent GET request ? Is it normal behavior , or am I overcooking / undercooking something , I am an embedded engineer , and therefore knowledge of HTTP is limited. Have I left a POST Header out in the original POST request .? I only support Content-Type and Content-Length in terms of the POST method.
Thanking you in advance.
question from:
https://stackoverflow.com/questions/65873559/why-does-the-return-response-of-google-app-script-dopost-gets-redirected 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…